SimulateMixture: Random Generation from a t Mixture Model with Box-Cox...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/SimulateMixture.R

Description

This function can be used to generate a sample from a multivariate t mixture model with Box-Cox transformation.

Usage

1
SimulateMixture(N, w, mu, sigma, nu = 4, lambda)

Arguments

N

The number of observations.

w

A vector of length K, containing the K cluster proportions.

mu

A matrix of size K x P, where K is the number of clusters and P is the dimension, containing the K mean vectors.

sigma

An array of dimension K x P x P, containing the K covariance matrices.

nu

The degrees of freedom used for the t distribution.

lambda

The Box-Cox transformation parameter. If missing, the conventional t distribution without transformation will be used.

Value

A matrix of size N x P.

Author(s)

Raphael Gottardo <raph@stat.ubc.ca>, Kenneth Lo <c.lo@stat.ubc.ca>

See Also

flowClust

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
library(flowCore)
library(flowClust)
### Number of components
K <- 5
### Dimension
p <- 2
### Number of observations
n <- 200
Mu <- matrix(runif(K*p, 0, 20), K, p)
Sigma <- array(0, c(K, p, p))

for (k in 1:K)
{
    Sigma[k,,][outer(1:p, 1:p, ">")] <- runif(p*(p-1)/2,-.1,.1)
    diag(Sigma[k,,]) <- runif(p,0,1)
    ### Make sigma positive definite
    Sigma[k,,] <- Sigma[k,,] %*% t(Sigma[k,,])
}

### Generate the weights
w <- rgamma(K,10,1)
w <- w/sum(w)

y <- SimulateMixture(n, w, Mu, Sigma, nu=4)

flowClust documentation built on Nov. 8, 2020, 7:34 p.m.