generate a random sample from a mixture of normals

Description

Generate a random sample from a mixture of normals.

Usage

1
rmix.norm(n, alpha, mu, sigma = rep(1,length(alpha)))

Arguments

n

sample size.

alpha

vector of mixture proportions of length m, the order of the mixture.

mu

vector of means of component distributions.

sigma

vector of standard deviations of component distributions, default value: sigma = rep(1,length(alpha)).

Value

Return a samples of size n from an m-component normal mixture.

Author(s)

Shaoting Li, Jiahua Chen and Pengfei Li

See Also

emtest.norm, emtest.norm0, plotmix.norm, plotmix.norm0, pmle.norm, pmle.norm0

Examples

1
2
3
4
#generate a random sample from a 2 component normal mixture,
#plot the histogram of the data.
x <- rmix.norm(200,c(0.3,0.7),c(-1,2),c(1,2))
hist(x)

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.