Gen_MM {RGMM}R Documentation

Gen_MM

Description

Generate a sample of a Mixture Model

Usage

Gen_MM(nk=NA, df=3, mu=NA, Sigma=FALSE, delta=0,cont="Student",
                model="Gaussian", dfcont=1, mucont=FALSE, Sigmacont=FALSE,
                minU=-20, maxU=20)

Arguments

nk

An integer vector containing the desired number of data for each class. The defulat is nk=rep(500,3).

df

An integer larger (or qual) than 3 specifying the degrees of freedom of the Student law, if model='Student'. Default is 3.

mu

A numeric matrix whose raws correspond to the centers of the classes. By default, mu is generated randomly.

Sigma

An array containing the variance of each class. See exemple for more details.

delta

A positive scalr between 0 and 1 giving the proportion of contaminated data. Default is 0.

cont

The kind of contamination chosen. Can be equal to 'Unif' or 'Student'.

model

A string character specifying the model chosen for the Mixture Model. Can be equal to 'Gaussian' (default) or 'Student'.

dfcont

A positive integer specifying the degrees of freedom of the contamination laws if cont='Student'. Default is 1.

mucont

A numeric matrix whose rows correspond to the centers of the contamination laws. By default, mucont is chosen equal to mu.

Sigmacont

An array containing the variance of each contamination law. By default, sigmacont is chosen equal to sigma.

minU

A scalar giving the lower bound of the uniform law of the contamination if cont='Unif'.

maxU

A scalar giving the upper bound of the uniform law of the contamination if cont='Unif'.

Value

A list with:

Z

An integer vector specifying the true classification. If delta is non nul, the contaminated data are consider as a class.

C

A 0-1 vector specifying the contaminated data.

X

A numerical matrix giving the generated data.

See Also

See also RobMM and RobVar.

Examples

p <- 3
nk <- rep(50,p)
mu <- c()
for (i in 1:length(nk))
{
  Z <- rnorm(3)
  mu <- rbind(mu,length(nk)*Z/sqrt(sum(Z^2)))
}
Sigma <- array(dim=c(length(nk), p, p))
for (i in 1:length(nk))
{
  Sigma[i, ,] <- diag(p)
}
ech <- Gen_MM(nk=nk,mu=mu,Sigma=Sigma)

[Package RGMM version 2.1.0 Index]