rwnormmix: The univariate Wrapped Normal mixtures

View source: R/all_wnorm_fns.R

rwnormmixR Documentation

The univariate Wrapped Normal mixtures

Description

The univariate Wrapped Normal mixtures

Usage

rwnormmix(n = 1, kappa, mu, pmix)

dwnormmix(x, kappa, mu, pmix, int.displ = 3, log = FALSE)

Arguments

n

number of observations. Ignored if at least one of the other parameters have length k > 1, in which case, all the parameters are recycled to length k to produce k random variates.

kappa

vector of component concentration (inverse-variance) parameters, kappa > 0.

mu

vector of component means.

pmix

vector of mixing proportions.

x

vector of angles (in radians) where the densities are to be evaluated.

int.displ

integer displacement. If int.displ = M, then the infinite sum in the density is approximated by a 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

pmix, mu and kappa must be of the same length, with j-th element corresponding to the j-th component of the mixture distribution.

The univariate wrapped normal mixture distribution with component size K = length(pmix) has density

g(x) = p[1] * f(x; κ[1], μ[1]) + ... + p[K] * f(x; κ[K], μ[K])

where p[j], κ[j], μ[j] respectively denote the mixing proportion, concentration parameter and the mean parameter for the j-th component and f(. ; κ, μ) denotes the density function of the (univariate) wrapped normal distribution with mean parameter μ and concentration parameter κ.

Value

dwnormmix computes the density and rwnormmix generates random deviates from the mixture density.

Examples

kappa <- 1:3
mu <- 0:2
pmix <- c(0.3, 0.3, 0.4)
x <- 1:10
n <- 10

# mixture densities calculated at each point in x
dwnormmix(x, kappa, mu, pmix)

# number of observations generated from the mixture distribution is n
rwnormmix(n, kappa, mu, pmix)


c7rishi/BAMBI documentation built on March 18, 2023, 6:17 p.m.