Learn R Programming

SpaDES (version 1.3.1)

dwrpnorm2: Vectorized wrapped normal density function

Description

This is a modified version of dwrpnorm found in CircStats to allow for multiple angles at once (i.e., vectorized).

Usage

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

the same as acc.

Examples

Run this code
# NOT RUN {
# 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)

# }

Run the code above in your browser using DataLab