Learn R Programming

rotations (version 1.0)

Haar: Uniform distribution

Description

Density, distribution function and random generation for the uniform distribution on the circle.

Usage

dhaar(r)

phaar(q, lower.tail = TRUE)

rhaar(n)

Arguments

r,q
vector of quantiles.
n
number of observations. If length(n)>1, the length is taken to be the number required.
lower.tail
logical; if TRUE (default), probabilities are $P(X \le x)$ otherwise, $P(X > x)$.

Value

  • dhaargives the density
  • phaargives the distribution function
  • rhaargenerates random deviates

Details

The uniform distribution on the interval $[-\pi,\pi)$ has density $$C_U(r)=\frac{[1-cos(r)]}{2\pi}$$ with respect to the Lebesgue measure. The Haar measure is a volume invariance measure for spaces such as SO(3) that plays the role of the uniform measure on SO(3). The uniform distribution with respect to the Haar measure is given by $$C_U(r)=\frac{1}{2\pi}$$. Because the uniform distribution on the circle with respect to the Haar measure gives a horizontal line at 1 with respect to the Lebesgue measure, we called this distribution 'Haar.'

See Also

Angular-distributions for other distributions in the rotations package.

Examples

Run this code
r <- seq(-pi, pi, length = 1000)

#Visualize the uniform distribution on the circle with respect to Lebesgue measure
plot(r, dhaar(r), type = 'l', ylab = 'f(r)')

#Visualize the uniform distribution on the circle with respect to Haar measure, which is
#a horizontal line at 1
plot(r, 2*pi*dhaar(r)/(1-cos(r)), type = 'l', ylab = 'f(r)')

#Plot the uniform CDF
plot(r,phaar(r), type = 'l', ylab = 'F(r)')

#Generate random observations from uniform circular distribution
rs <- rhaar(50)

#Visualize on the real line
hist(rs, breaks = 10)

Run the code above in your browser using DataLab