Learn R Programming

mclust (version 5.4.3)

cvMclustDA: MclustDA cross-validation

Description

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

Usage

cvMclustDA(object, nfold = 10, verbose = interactive(), …)

Arguments

object

An object of class 'MclustDA' resulting from a call to MclustDA.

nfold

An integer specifying the number of folds.

verbose

A logical controlling if a text progress bar is displayed during the cross-validation procedure. By default is TRUE if the session is interactive, and FALSE otherwise.

Further arguments passed to or from other methods.

Value

The function returns a list with the following components:

classification

a factor of cross-validated class labels.

z

a matrix containing the cross-validated probabilites for class assignement.

error

the cross-validation error.

se

the standard error of cv error.

See Also

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

Examples

Run this code
# NOT RUN {
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 <- cvMclustDA(irisMclustDA) # default 10-fold CV
cv[c("error", "se")]

cv <- cvMclustDA(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 <- cvMclustDA(irisMclustDA) # default 10-fold CV
cv[c("error", "se")]
# }

Run the code above in your browser using DataLab