Learn R Programming

circular (version 0.5-1)

wrappedNormal: Wrapped Normal Density Function

Description

Density, and random generation for the wrapped normal circular distribution.

Usage

rwrappednormal(n, mu = circular(0), rho = NULL, sd = 1, 
  control.circular = list())
dwrappednormal(x, mu = circular(0), rho = NULL, sd = 1, 
  K = NULL, min.k = 10)
pwrappednormal(q, mu = circular(0), rho = NULL, sd = 1, 
  from = NULL, K = NULL, min.k = 10, ...)
qwrappednormal(p, mu = circular(0), rho = NULL, sd = 1, 
  from = NULL, K = NULL, min.k = 10, tol = .Machine$double.eps^(0.6), 
  control.circular = list(), ...)

Value

dwrappednormal gives the density and rwrappednormal

generates random deviates, pwrappednormal gives the distribution function, and qwrappednormal provides quantiles.

Arguments

x, q

vector of quantiles. The object is coerced to class circular.

p

vector of probabilities.

n

number of observations.

mu

mean direction of the distribution as a circular object.

rho

concentration parameter of the distribution. rho must be in the interval from 0 to 1.

sd

standard deviation of the (unwrapped) normal distribution.

from

if NULL is set to \(mu-pi\). This is the value from which the pwrappednormal and qwrappednormal are evaluated. It should be a circular object.

K

number of terms to be used in approximating the density.

min.k

minimum number of terms used in approximating the density.

tol

passed to uniroot.

control.circular

the attribute of the resulting object.

...

parameters passed to integrate.

Author

Claudio Agostinelli and Ulric Lund

References

Jammalamadaka, S. Rao and SenGupta, A. (2001). Topics in Circular Statistics, Section 2.2.7, World Scientific Press, Singapore.

Examples

Run this code

data1 <- rwrappednormal(100, mu=circular(0), rho=0.7, 
  control.circular=list(units="degrees"))
plot(data1)

ff <- function(x) dwrappednormal(x, mu=circular(pi), rho=0.7)
curve.circular(ff, join=TRUE, xlim=c(-1.5, 1), 
  main="Density of a Wrapped Normal Distribution \n mu=pi, rho=0.7")

ff <- function(x) pwrappednormal(x, mu=circular(pi), rho=0.7)
curve.circular(ff, join=FALSE, xlim=c(-2, 2), ylim=c(-2, 2), 
  to=(2*pi-3*.Machine$double.eps), modulo="asis", nosort=TRUE, 
  main="Probability of a Wrapped Normal Distribution \n mu=pi, 
  rho=0.7, from=0")

ff <- function(x) pwrappednormal(x, mu=circular(pi), rho=0.7, from=circular(pi))
curve.circular(ff, join=FALSE, xlim=c(-2, 2), ylim=c(-2, 2), from=-pi, 
  to=(pi-3*.Machine$double.eps), modulo="asis", nosort=TRUE, 
  main="Probability of a Wrapped Normal Distribution \n mu=pi, 
  rho=0.7, from=pi")

plot(qwrappednormal, from=0, to=1)
plot(function(x) qwrappednormal(p=x, mu=circular(pi)), from=0, to=1)

Run the code above in your browser using DataLab