rNM: Simulated from Normal Mixture Model

Description Usage Arguments Value Examples

View source: R/DataGen.R

Description

Draws realizations from a normal mixture model. First, the cluster membership is drawn from a multinomial distribution, with mixture proportions specified by pi. Conditional on cluster membership, the observation is drawn from a multivariate normal distribution, with cluster-specific mean and variance. The cluster means are provided using m, and the cluster covariance matrices are provided using v.

Usage

1
rNM(n, k = 1, pi = NULL, m = 0, v = 1)

Arguments

n

Observations.

k

Number of mixture components. Defaults to 1.

pi

Mixture proportions. If omitted, components are assumed equi-probable.

m

Vector of means, one for each component k.

v

Vector of variances, one for each component k.

Value

Numeric matrix containing the mixture component and the observation.

Examples

1
2
3
4
5
## Not run: 
# Two component mixture
Y = rNM(n=1e3,k=2,pi=c(0.95,0.05),m=c(0,2),v=c(1,1));

## End(Not run)

zrmacc/LFDR documentation built on May 3, 2019, 9:01 p.m.