View source: R/Final_functions.R
Gen_MM | R Documentation |
Generate a sample of a Mixture Model
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)
nk |
An integer vector containing the desired number of data for each class. The defulat is |
df |
An integer larger (or qual) than |
mu |
A numeric matrix whose raws correspond to the centers of the classes. By default, |
Sigma |
An array containing the variance of each class. See exemple for more details. |
delta |
A positive scalr between |
cont |
The kind of contamination chosen. Can be equal to |
model |
A string character specifying the model chosen for the Mixture Model. Can be equal to |
dfcont |
A positive integer specifying the degrees of freedom of the contamination laws if |
mucont |
A numeric matrix whose rows correspond to the centers of the contamination laws. By default, |
Sigmacont |
An array containing the variance of each contamination law. By default, |
minU |
A scalar giving the lower bound of the uniform law of the contamination if |
maxU |
A scalar giving the upper bound of the uniform law of the contamination if |
A list with:
Z |
An integer vector specifying the true classification. If |
C |
A |
X |
A numerical matrix giving the generated data. |
See also RobMM
and RobVar
.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.