This is a modified version of dwrpnorm in the CircStats package to allow for multiple angles at once (i.e., vectorized on theta and mu).

dwrpnorm2(theta, mu, rho, sd = 1, acc = 1e-05, tol = acc)

Arguments

theta

value at which to evaluate the density function, measured in radians.

mu

mean direction of distribution, measured in radians.

rho

mean resultant length of distribution.

sd

different way of select rho, see details below.

acc

parameter defining the accuracy of the estimation of the density. Terms are added to the infinite summation that defines the density function until successive estimates are within acc of each other.

tol

same as acc.

Author

Eliot McIntire

Examples

# Values for which to evaluate density
theta <- c(1:500) * 2 * pi / 500
# Compute wrapped normal density function
density <- c(1:500)
for(i in 1:500) {
  density[i] <- dwrpnorm2(theta[i], pi, .75)
}

if (interactive()) {
  plot(theta, density)
}

# Approximate area under density curve
sum(density * 2 * pi / 500)
#> [1] 1