# dcircmix: Mixtures of circular distributions In NPCirc: Nonparametric Circular Methods

## Description

Density and random generation functions for a circular distribution or a mixture of circular distributions allowing the following components: circular uniform, von Mises, cardioid, wrapped Cauchy, wrapped normal, wrapped skew-normal.

## Usage

 1 2 dcircmix(x, model=NULL, dist=NULL, param=NULL) rcircmix(n, model=NULL, dist=NULL, param=NULL)

## Arguments

 x Vector of angles where the density is evaluated. The object is coerced to class circular. n Number of observations to generate. model Number between 1 and 20, corresponding with a model defined in Oliveira et al. (2012). See Details. dist Vector of strings with the distributions that participate in the mixture: "unif", "vm", "car", "wc", "wn", "wsn". param List with three or four objects. The first object will be a vector containing the proportion of each distribution in the mixture, the second object will be a vector containg the location parameters and the third object will be a vector containing the concentration parameters. If the wrapped skew-normal distribution participates in the mixture, a fourth object will be introduced in the list, a vector containing the skewness parameter. In this case, the values of the skewness parameter for the rest of distributions in the mixture will be zero. The length of each object in the list must be equal to the length of argument dist. See Details and Examples.

## Details

Models from Oliveira et al. (2012) are described below:

M1: Circular uniform.

M2: von Mises: vM(π,1).

M3: Wrapped normal: WN(π,0.9).

M4: cardioid: C(π,0.5).

M5: Wrapped Cauchy: WC(π,0.8).

M6: Wrapped skew–normal: WSN(π,1,20).

M7: Mixture of two von Mises 1/2 vM(0,4) + 1/2 vM(π,4).

M8: Mixture of two von Mises 1/2 vM(2,5) + 1/2 vM(4,5).

M9: Mixture of two von Mises 1/4 vM(0,2) + 3/4 vM(π/√{3},2).

M10: Mixture of von Mises and wrapped Cauchy 4/5 vM(π,5) + 1/5 WC(4π/3,0.9).

M11: Mixture of three von Mises 1/3 vM(π/3,6) + 1/3 vM(π,6) + 1/3 vM(5π/3,6).

M12: Mixture of three von Mises 2/5 vM(π/2,4) + 1/5 vM(π,5) + 2/5 vM(3π/2,4).

M13: Mixture of three von Mises 2/5 vM(0.5,6) + 2/5 vM(3,6) + 1/5 vM(5,24).

M14: Mixture of four von Mises 1/4 vM(0,12) + 1/4 vM(π/2,12) + 1/4 vM(π,12) + 1/4 vM(3π/2,12).

M15: Mixture of wrapped Cauchy, wrapped normal, von Mises and wrapped skew-normal 3/10 WC(π-1,0.6) + 1/4 WN(π+0.5,0.9) + 1/4 vM(π+2,3) + 1/5 WSN(6,1,3).

M16: Mixture of five von Mises 1/5 vM(π/5,18) + 1/5 vM(3π/5,18) + 1/5 vM(π,18) + 1/5 vM(7π/5,18) + 1/5 vM(9π/5,18).

M17: Mixture of cardioid and wrapped Cauchy 2/3 C(π,0.5) + 1/3 WC(π,0.9).

M18: Mixture of four von Mises 1/2 vM(π,1) + 1/6 vM(π-0.8,30) + 1/6 vM(π,30) + 1/ vM(π+0.8,30).

M19: Mixture of five von Mises 4/9 vM(2,3) + 5/36 vM(4,3) + 5/36 vM(3.5,50) + 5/36 vM(4,50) + 5/36 vM(4.5,50).

M20: Mixture of two wrapped skew-normal and two wrapped Cauchy 1/3 WSN(0,0.7,20) + 1/3 WSN(π,0.7,20) + 1/6 WC(3π/4,0.9) + 1/6 WC(7π/4,0.9).

When the wrapped skew-normal distribution participates in the mixture, the argument param for function dcircmix can be a list with fifth objects. The fifth object would be the number of terms to be used in approximating the density function of the wrapped skew normal distribution. By default the number of terms used is 20.

## Value

dcircmix gives the density and rcircmix generates random deviates.

## Author(s)

Mar?a Oliveira, Rosa M. Crujeiras and Alberto Rodr?guez–Casal

## References

Oliveira, M., Crujeiras, R.M. and Rodr?guez–Casal, A. (2012) A plug–in rule for bandwidth selection in circular density. Computational Statistics and Data Analysis, 56, 3898–3908.

Oliveira, M., Crujeiras R.M. and Rodr?guez–Casal, A. (2014) NPCirc: an R package for nonparametric circular methods. Journal of Statistical Software, 61(9), 1–26. https://www.jstatsoft.org/v61/i09/

## Examples

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 set.seed(2012) # Circular representation of models M1-M20, each one in a separate window for (i in 1:20){ dev.new() f <- function(x) dcircmix(x, model=i) curve.circular(f, n=500, join=TRUE, shrink=1.9, main=i) } # Random generation from model M1 (uniform model) data1 <- rcircmix(50, model=1) plot(data1) # Density function and random generation from a mixture of a von Mises and # a wrapped skew-normal f <- function(x) dcircmix(x, model=NULL, dist=c("vm","wsn"), param=list(p=c(0.5,0.5), mu=c(0,pi), con=c(1,1), sk=c(0,10))) curve.circular(f, n=500, shrink=1.2) data <- rcircmix(100, model=NULL, dist=c("vm","wsn"), param=list(p=c(0.5,0.5), mu=c(0,pi), con=c(1,1), sk=c(0,10))) points(data) # Density function and random generation from a mixture of two von Mises and # two wrapped Cauchy f <- function(x) dcircmix(x, model=NULL, dist=c("vm","vm","wc","wc"), param=list(p=c(0.3,0.3,0.2,0.2), mu=c(0,pi,pi/2,3*pi/2), con=c(5,5,0.9,0.9))) curve.circular(f, n=1000, xlim=c(-1.65,1.65)) data <- rcircmix(100, model=NULL, dist=c("vm","vm","wc","wc"), param=list(p=c(0.3,0.3,0.2,0.2), mu=c(0,pi,pi/2,3*pi/2), con=c(5,5,0.9,0.9))) points(data)

### Example output

Attaching package:circularThe following objects are masked frompackage:stats:

sd, var

Warning messages:
1: no DISPLAY variable so Tk is not available
2: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
3: 'rgl.init' failed, running with 'rgl.useNULL = TRUE'.
dev.new(): using pdf(file="Rplots1.pdf")
dev.new(): using pdf(file="Rplots2.pdf")
dev.new(): using pdf(file="Rplots3.pdf")
dev.new(): using pdf(file="Rplots4.pdf")
dev.new(): using pdf(file="Rplots5.pdf")
dev.new(): using pdf(file="Rplots6.pdf")
dev.new(): using pdf(file="Rplots7.pdf")
dev.new(): using pdf(file="Rplots8.pdf")
dev.new(): using pdf(file="Rplots9.pdf")
dev.new(): using pdf(file="Rplots10.pdf")
dev.new(): using pdf(file="Rplots11.pdf")
dev.new(): using pdf(file="Rplots12.pdf")
dev.new(): using pdf(file="Rplots13.pdf")
dev.new(): using pdf(file="Rplots14.pdf")
dev.new(): using pdf(file="Rplots15.pdf")
dev.new(): using pdf(file="Rplots16.pdf")
dev.new(): using pdf(file="Rplots17.pdf")
dev.new(): using pdf(file="Rplots18.pdf")
dev.new(): using pdf(file="Rplots19.pdf")

NPCirc documentation built on July 22, 2021, 5:06 p.m.