Skip to contents

Simulate from a normal mixture distribution

Usage

rnormalmix(n, sd, pi, mu = 0, return.Z = FALSE)

Arguments

n

Number of points to simulate

pi

Mixture proportions

mu

Means

return.Z

if TRUE, also return a vector of indicators indicating which of the K classes each sample belongs to

sigma

Standard deviations

Value

If return.Z=TRUE, returns a list with elements beta (samples) and Z (indicators). Otherwise returns a length n vector of samples.