Learn R Programming

circular (version 0.4-93)

vonMises: von Mises Density Function

Description

Density, distribution function, random generation and quantiles for the von Mises circular distribution.

Usage

rvonmises(n, mu, kappa, control.circular=list())
dvonmises(x, mu, kappa, log)
pvonmises(q, mu, kappa, from=NULL, tol = 1e-020)
qvonmises(p, mu = circular(0), kappa=NULL, from=NULL, tol = .Machine$double.eps^(0.6), 
  control.circular = list(), …)

Arguments

x, q, p

a vector. The x and q objects are coerced to class circular.

n

number of observations.

mu

mean direction of the distribution. The object is coerced to class circular.

kappa

non-negative numeric value for the concentration parameter of the distribution.

log

logical; if TRUE, probabilities p are given as log(p).

from

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

tol

the precision in evaluating the distributon function or the quantile.

control.circular

the attribute of the resulting object.

…

parameters passed to integrate.

Value

dvonmises gives the density, pvonmises gives the distribution function, rvonmises generates random deviates and qvonmises provides quantiles.

Since version 0.3-5 the random deviates are generated using a C code.

References

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

Examples

Run this code
# NOT RUN {
data1 <- rvonmises(100, circular(0), 10, control.circular=list(units="degrees"))
plot(data1)

ff <- function(x) dvonmises(x, mu=circular(pi), kappa=10)
curve.circular(ff, join=TRUE, xlim=c(-2.3, 1),
  main="Density of a VonMises Distribution \n mu=pi, kappa=10")

ff <- function(x) pvonmises(x, mu=circular(pi), kappa=10)
curve.circular(ff, join=FALSE, xlim=c(-2, 2), ylim=c(-2, 1), 
  to=(2*pi-3*.Machine$double.eps), modulo="asis", nosort=TRUE, 
  main="Probability of a VonMises Distribution \n mu=pi, kappa=10")

plot(function(x) qvonmises(x, mu=circular(0), kappa=5), from=0, to=1)
##curve do not work!
plot(function(x) qvonmises(x, mu=circular(pi), kappa=5), from=0, to=1)
plot(function(x) qvonmises(x, mu=circular(pi), kappa=5, from=circular(pi/2)), from=0, to=1)
# }

Run the code above in your browser using DataLab