Learn R Programming

RVAideMemoire (version 0.9-45-2)

DA.valid: Cross-validation in Discriminant Analysis

Description

Performs a cross-validation to assess the prediction ability of a Discriminant Analysis. Linear Discriminant Analysis (from lda), Partial Least Squares - Discriminant Analysis (from plsda) and Correspondence Discriminant Analysis (from discrimin.coa) are handled. Two methods are implemented for cross-validation: leave-one-out and M-fold.

Usage

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

Arguments

model
object of class "lda" (from lda), "plsda" (from plsda) or "coadisc" (from
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".
crit.cda
prediction method to be applied for CDA cross-validation. Should be a subset of "mahalanobis" (default) or "euclidian".
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.
  • crit.cdadistance used in CDA 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. When working on a LDA, 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, perf, discrimin.coa, predict.coadisc

Examples

Run this code
# With a LDA
require(MASS)
data(iris)

model.LDA <- lda(iris[,1:4],iris$Species)
DA.valid(model.LDA)

Run the code above in your browser using DataLab