gaussSim {UEM}R Documentation

Simulating from mixture models

Description

Functions to simulate data from Gaussian, Poisson, and Cauchy mixtures.

Usage

gaussSim(theta)
gaussSimN(n, theta)
poisSim(theta)
poisSimN(n, theta)
cauchSim(theta)
cauchSimN(n, theta)

Arguments

theta

a list with elements pi (vector of mixture proportions), mu (a matrix where each row is one mean vector), and Sigma (a list of as many variance matrices as mixture components). In the case of the Cauchy model, Sigma is a list of gamma parameters.

n

sample size

Author(s)

J. Einbeck, D. Bonetti, Z. Kalantan

Examples

rho   <-0.7 
Sigma <- list(diag(c(1,2)), matrix(c(2, 2*rho, 2*rho, 1), byrow=TRUE, ncol=2))
theta <-list(pi=c(1/3, 2/3), mu=matrix(c(3,1,0,4), byrow=TRUE, ncol=2), Sigma=Sigma)
sim  <- gaussSimN(1000, theta)

fit2 <- EM(sim, K=2)
plot.umix(fit2)

sim1 <- cauchSimN(100,theta=list(pi=rep(0.5,2), mu=c(0,20), Sigma=list(gamma=1, gamma=2)))
hist(sim1, breaks=40)


[Package UEM version 0.3-1 Index]