dwrpnorm2: Vectorized wrapped normal density function

View source: R/probability.R

dwrpnorm2R Documentation

Vectorized wrapped normal density function

Description

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).

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

same as acc.

Author(s)

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)


PredictiveEcology/SpaDES.tools documentation built on April 18, 2024, 3:21 a.m.