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

Description Usage Arguments Value Author(s) See Also Examples

View source: R/rmix.norm.R

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)

MixtureInf documentation built on May 30, 2017, 6:56 a.m.

Search within the MixtureInf package
Search all R packages, documentation and source code