Last chance! 50% off unlimited learning
Sale ends in
mclustDA(train, test, pro=NULL, G=NULL, modelNames=NULL, prior=NULL,
control=emControl(), initialization=NULL,
warn=FALSE, verbose=FALSE, ...)
data
giving the data
and labels
giving the class labels for the observations in
the data.data
giving the data
and labels
giving the class labels for the observations in
the data. The labels are used only to compute the error rate
in the print
method and can G=1:9
.mclustModelNames
describes the available models.
The default is c("E", "V")
for univariate data and
priorControl
.emControl()
.hc
. The default is to compute a hierarchical
clustering treemclustDA
results including
the mixture models and numbers of components for the training classes.do.call
C. Fraley and A. E. Raftery (2006). MCLUST Version 3 for R: Normal Mixture Modeling and Model-Based Clustering, Technical Report no. 504, Department of Statistics, University of Washington.
mclustDA
combines functions mclustDAtrain
and
mclustDAtest
and their summaries. This is suitable when
all test data are available in advance, so that the training
model is only used once.plot.mclustDA
,
mclustDAtrain
,
mclustDAtest
,
classError
n <- 250 ## create artificial data
set.seed(1)
triModal <- c(rnorm(n,-5), rnorm(n,0), rnorm(n,5))
triClass <- c(rep(1,n), rep(2,n), rep(3,n))
odd <- seq(from = 1, to = length(triModal), by = 2)
even <- odd + 1
triMclustDA <- mclustDA(train=list(data=triModal[odd],labels=triClass[odd]),
test= list(data=triModal[even],labels=triClass[even]),
verbose = TRUE)
names(triMclustDA)
plot(triMclustDA, trainData = triModal[odd], testData = triModal[even])
odd <- seq(from = 1, to = nrow(cross), by = 2)
even <- odd + 1
crossMclustDA <- mclustDA( train=list(data=cross[odd,-1],
labels=cross[odd,1]),
test= list(data=cross[even,-1],labels=cross[even,1]),
verbose = TRUE)
plot(crossMclustDA, trainData = cross[odd,-1], testData = cross[even,-1])
odd <- seq(from = 1, to = nrow(iris), by = 2)
even <- odd + 1
irisMclustDA <- mclustDA(train=list(data=iris[odd,-5],labels=iris[odd,5]),
test= list(data=iris[even,-5],labels=iris[even,5]),
verbose = TRUE)
plot(irisMclustDA, trainData = iris[odd,-5], testData = iris[even,-5])
Run the code above in your browser using DataLab