Learn R Programming

mclust (version 4.1)

cv.MclustDA: MclustDA cross-validation

Description

K-fold cross-validation for discriminant analysis based on Gaussian finite mixture modeling.

Usage

cv.MclustDA(object, nfold = 10, verbose = TRUE, ...)

Arguments

object
An object of class "MclustDA" resulting from a call to MclustDA.
nfold
An integer specifying the number of folds.
verbose
A logical, if TRUE display the running algorithm.
...
Further arguments passed to or from other methods.

Value

  • The function returns a list with the following components:
  • classificationa factor of cross-validated class labels.
  • errorthe cross-validation error.
  • sethe standard error of cv error.

References

C. Fraley and A. E. Raftery (2002). Model-based clustering, discriminant analysis, and density estimation. Journal of the American Statistical Association 97:611-631.

C. Fraley, A. E. Raftery, T. B. Murphy and L. Scrucca (2012). mclust Version 4 for R: Normal Mixture Modeling for Model-Based Clustering, Classification, and Density Estimation. Technical Report No. 597, Department of Statistics, University of Washington.

See Also

summary.MclustDA, plot.MclustDA, predict.MclustDA, classError

Examples

Run this code
X <- iris[,-5]
Class <- iris[,5]

# common EEE covariance structure (which is essentially equivalent to linear discriminant analysis)
irisMclustDA <- MclustDA(X, Class, modelType = "EDDA", modelNames = "EEE")
cv <- cv.MclustDA(irisMclustDA) # default 10-fold CV
cv[c("error", "se")]

cv <- cv.MclustDA(irisMclustDA, nfold = length(Class)) # LOO-CV
cv[c("error", "se")] 
# compare with 
# cv1EMtrain(X, Class, "EEE")

# general covariance structure selected by BIC
irisMclustDA <- MclustDA(X, Class)
cv <- cv.MclustDA(irisMclustDA) # default 10-fold CV
cv[c("error", "se")]

Run the code above in your browser using DataLab