Learn R Programming

RVAideMemoire (version 0.9-35)

DA.valid: Cross-validation in Discriminant Analysis

Description

Perform a cross-validation to assess the prediction ability of a Discriminant Analysis. Linear Discriminant Analysis (by using lda) and Partial Least Squares - Discriminant Analysis (by using plsda) are handled. Two methods are implemented for cross-validation: leave-one-out and M-fold.

Usage

DA.valid(model, method = c("loo", "Mfold"), crit.lda = c("plug-in", "predictive",
  "debiased"), crit.plsda = c("mahalanobis.dist", "centroids.dist", "max.dist"),
  M = 10, nrep = 20)

Arguments

model
object of class "lda" (from lda) or "plsda" (from plsda).
method
what kind of validation to use, matching one of "Mfold" or "loo" (see below). Default is "Mfold".
crit.lda
this determines how the parameter estimation is handled in LDA cross-validation. With "plug-in" (the default) the usual unbiased parameter estimates are used and assumed to be correct. With "debiased" an unbiased estimator of the
crit.plsda
prediction method to be applied for PLS-DA cross-validation. Should be a subset of "mahalanobis.dist" (default), "centroids.dist" or "max.dist".
M
the number of folds in the M-fold cross-validation.
nrep
the number of repetitions of the whole procedure in the M-fold cross-validation.

Value

  • modeltype of discriminant model used.
  • methodmethod used for cross-validation.
  • crit.ldamethod for parameter estimation in LDA cross-validation.
  • crit.plsdadistance used in PLS-DA cross-validation.
  • Mnumber of folds in the M-fold cross-validation.
  • nrepnumber of repetitions in the M-fold cross-validation.
  • tabresults of cross-validation.

Details

Leave-one-out cross-validation is not recommended with PLS-DA models. When working on a LDA model, the prior probabilities for the models fitted on the training datasets are extracted from model (they are not evaluated from the training dataset itself).

See Also

lda, predict.lda, plsda, valid

Examples

Run this code
# Cross-validation of a LDA model
require(MASS)
data(iris)
model.LDA <- lda(iris[,1:4],iris$Species)
DA.valid(model.LDA,M=5,nrep=10)

# Cross-validation of a PLS-DA model
require(mixOmics)
data(yeast)
model.PLSDA <- plsda(t(yeast$data),yeast$strain.cond)
DA.valid(model.PLSDA,M=5,nrep=10)

Run the code above in your browser using DataLab