Learn R Programming

BAMBI (version 2.3.5)

rwnorm2mix: The bivariate Wrapped Normal mixtures

Description

The bivariate Wrapped Normal mixtures

Usage

rwnorm2mix(n, kappa1, kappa2, kappa3, mu1, mu2, pmix, ...)

dwnorm2mix(x, kappa1, kappa2, kappa3, mu1, mu2, pmix, int.displ, log = FALSE)

Value

dwnorm2mix computes the density and rwnorm2mix generates random deviates from the mixture density.

Arguments

n

number of observations.

kappa1, kappa2, kappa3

vectors of concentration parameters; kappa1, kappa2 > 0, kappa3^2 < kappa1*kappa2 for each component.

mu1, mu2

vectors of mean parameters.

pmix

vector of mixture proportions.

...

additional arguments passed to rmvnorm from package mvtnorm

x

matrix of angles (in radians) where the density is to be evaluated, with each row being a single bivariate vector of angles.

int.displ

integer displacement. If int.displ = M, then each infinite sum in the density is approximated by a finite sum over 2*M + 1 elements. (See Details.) The allowed values are 1, 2, 3, 4 and 5. Default is 3.

log

logical. Should the log density be returned instead?

Details

All the argument vectors pmix, kappa1, kappa2, kappa3, mu1 and mu2 must be of the same length, with \(j\)-th element corresponding to the \(j\)-th component of the mixture distribution.

The bivariate wrapped normal mixture distribution with component size K = length(pmix) has density $$g(x) = \sum p[j] * f(x; \kappa_1[j], \kappa_2[j], \kappa_3[j], \mu_1[j], \mu_2[j])$$ where the sum extends over \(j\); \(p[j]; \kappa_1[j], \kappa_2[j], \kappa_3[j]\); and \(\mu_1[j], \mu_2[j]\) respectively denote the mixing proportion, the three concentration parameters and the two mean parameter for the \(j\)-th component, \(j = 1, ..., K\), and \(f(. ; \kappa_1, \kappa_2, \kappa_3, \mu_1, \mu_2)\) denotes the density function of the wrapped normal distribution with concentration parameters \(\kappa_1, \kappa_2, \kappa_3\) and mean parameters \(\mu_1, \mu_2\).

Examples

Run this code
kappa1 <- c(1, 2, 3)
kappa2 <- c(1, 6, 5)
kappa3 <- c(0, 1, 2)
mu1 <- c(1, 2, 5)
mu2 <- c(0, 1, 3)
pmix <- c(0.3, 0.4, 0.3)
x <- diag(2, 2)
n <- 10

# mixture densities calculated at the rows of x
dwnorm2mix(x, kappa1, kappa2, kappa3, mu1, mu2, pmix)

# number of observations generated from the mixture distribution is n
rwnorm2mix(n, kappa1, kappa2, kappa3, mu1, mu2, pmix)

Run the code above in your browser using DataLab