Learn R Programming

circular (version 0.3-1)

density.circular: Kernel Density Estimation for Circular Data

Description

The function density.circular computes kernel density estimates with the given kernel and bandwidth for circular data.

Usage

## S3 method for class 'circular':
density(x, z, bw, adjust = 1, type = c("K", "L"),
     kernel = c("vonmises", "wrappednormal"), na.rm = FALSE, from = 0,
     to = 2 * pi, n = 512, K = 10, ...)
## S3 method for class 'density.circular':
print(x, digits = NULL, \dots)

Arguments

x
the data from which the estimate is to be computed.
z
the points where the density is estimated. If missing equally spaced points are used according to the parameters from, to and n.
bw
the smoothing bandwidth to be used. When the kernel is vonmises the bandwidth is equal to the concentration parameter.
adjust
the bandwidth used is actually adjust*bw. This makes it easy to specify values like ``half the default bandwidth''.
type
Not Yet Used.
kernel
a character string giving the smoothing kernel to be used. This must be one of "vonmises" or "wrappednormal", that are kernels of type "K".
na.rm
logical; if TRUE, missing values are removed from x. If FALSE any missing values cause an error.
from, to
the left and right-most points of the grid at which the density is to be estimated.
n
the number of equally spaced points at which the density is to be estimated.
K
number of terms to be used in approximating the density.
digits
integer indicating the precision to be used.
...
further arguments passed to or from other methods.

Value

  • an object with class "density.circular" whose underlying structure is a list containing the following components.
  • dataoriginal dataset.
  • xthe n coordinates of the points where the density is estimated.
  • ythe estimated density values.
  • bwthe bandwidth used.
  • Nthe sample size after elimination of missing values.
  • callthe call which produced the result.
  • data.namethe deparsed name of the x argument.
  • has.nalogical, for compatibility (always FALSE).

References

Z.D. Bai and C.R. Rao and L.C. Zhao (1988). Kernel Estimators of Density Function of Directional Data, Journal of Multivariate Analysis, 27, 24-39.

J. Klemel"a (2000). Estimation of densities and derivatives of densities with directioinal data, Journal of Multivariate Analysis, 73, 18-40.

V.R. Prayag and A.P. Gore (1990). Density Estimation for Randomly Distributed Circular Objects, Metrika, 1990, 37, 63-69.

P. Hall and G.S. Watson and J. Cabrera (1987). Kernel Density Estimation with Spherical Data, Biometrika, 74, 4, 751--762.

See Also

plot.density.circular and lines.density.circular

Examples

Run this code
x <- rvonmises(n=100, mu=pi, kappa=2)
res25 <- density(x, bw=25)
plot(res25, points.plot=TRUE, xlim=c(-1.5,1))
res50 <- density(x, bw=25, adjust=2)
lines(res50, col=2)

Run the code above in your browser using DataLab