rmix.norm: generate a random sample from a mixture of normals

Description Usage Arguments Value Author(s) See Also Examples

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)

Example output



MixtureInf documentation built on May 2, 2019, 3:32 p.m.