set.seed(0)
n <- 100 ## create artificial data
x <- rbind(matrix(rnorm(n*2), n, 2) %*% diag(c(1,9)),
matrix(rnorm(n*2), n, 2) %*% diag(c(1,9))[,2:1])
xclass <- c(rep(1,n),rep(2,n))
par(pty = "s")
mclust2Dplot(x, classification = xclass, type="classification", ask=FALSE)
odd <- seq(1, 2*n, 2)
train <- mclustDAtrain(x[odd, ], labels = xclass[odd]) ## training step
summary(train)
Run the code above in your browser using DataLab