sim_mix: Simulate from mixture model.

Description Usage Arguments Value Author(s) Examples

View source: R/netsim.R

Description

Simulate from mixture model with multi-variate Gaussian or t-distributed components.

Usage

1
sim_mix(n, n.comp, mix.prob, Mu, Sig, dist = "norm", df = 2)

Arguments

n

sample size

n.comp

number of mixture components ("comps")

mix.prob

mixing probablities (need to sum to 1)

Mu

matrix of component-specific mean vectors

Sig

array of component-specific covariance matrices

dist

'norm' for Gaussian components, 't' for t-distributed components

df

degrees of freedom of the t-distribution (not used for Gaussian distribution), default=2

Value

a list consisting of:

S

component assignments

X

observed data matrix

Author(s)

n.stadler

Examples

1
2
3
4
5
6
7
n.comp = 4
p = 5 # dimensionality
Mu = matrix(rep(0, p), p, n.comp)
Sigma = array(diag(p), c(p, p, n.comp))
mix.prob = rep(0.25, n.comp)

sim_mix(100, n.comp, mix.prob, Mu, Sigma)

nethet documentation built on Nov. 8, 2020, 6:54 p.m.