Learn R Programming

nspmix (version 2.0-0)

dmix: Density function of a mixture distribution

Description

Computes the density or their logarithmic values of a mixture distribution, where the component family depends on the class of x.

x must belong to a mixture family, as specified by its class.

Usage

dmix(x, mix, beta = NULL, log = FALSE)

Arguments

x

a data object of a mixture model class.

mix

a discrete distribution, as defined by class disc.

beta

the structural parameter, if any.

log

if TRUE, computes the log-values, or else just the density values.

Author

Yong Wang <yongwang@auckland.ac.nz>

References

Wang, Y. (2007). On fast computation of the non-parametric maximum likelihood estimate of a mixing distribution. Journal of the Royal Statistical Society, Ser. B, 69, 185-198.

Wang, Y. (2010). Maximum likelihood computation for fitting semiparametric mixture models. Statistics and Computing, 20, 75-86

See Also

cnm, cnmms, npnorm, nppois, disc,

Examples

Run this code

## Poisson mixture
mix0 = disc(c(1,4), c(0.7,0.3))
x = rnppois(10, mix0)
dmix(x, mix0)
dmix(x, mix0, log=TRUE)

## Normal mixture
x = rnpnorm(10, mix0, sd=1)
dmix(x, mix0, 1)
dmix(x, mix0, 1, log=TRUE)
dmix(x, mix0, 0.5, log=TRUE)

Run the code above in your browser using DataLab