Learn R Programming

RVAideMemoire (version 0.9-45-2)

DA.confusion: Classification error rate of a Discriminant Analysis

Description

Computes the classification error rate of a Discriminant Analysis. The function divides the data in a training and a testing dataset, and predict the class of the individuals of the testing dataset by using the model fitted with the training dataset. Linear Discriminant Analysis (from lda), Partial Least Squares - Discriminant Analysis (from plsda) and Correspondence Discriminant Analysis (from discrimin.coa) are handled.

Usage

DA.confusion(model, train = 2/3, crit.lda = c("plug-in", "predictive","debiased"),
  crit.plsda = c("mahalanobis.dist", "centroids.dist", "max.dist"),
  crit.cda = c("mahalanobis", "euclidian"))

Arguments

model
object of class "lda" (from lda), "plsda" (from plsda) or "coadisc" (from
train
proportion of the total number of individuals to be used to build the training dataset.
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".

Value

  • modeltype of discriminant model used.
  • crit.ldamethod for parameter estimation when working on a LDA.
  • crit.plsdadistance used when working on a PLS-DA.
  • crit.cdadistance used in CDA cross-validation.
  • prop.traina vector giving the number of individuals used to build the training dataset (used) and the total number of individuals (total).
  • ind.for.trainindividuals used to build the training dataset.
  • predictedvector of predicted classes.
  • confusionconfusion matrix.
  • prop.confusionclassification error rate.

Details

When working on a LDA, the prior probabilities for the model fitted on the training dataset are extracted from model (they are not evaluated from the training dataset itself).

See Also

lda, predict.lda, plsda, predict.plsda, discrimin.coa, predict.coadisc

Examples

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

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

Run the code above in your browser using DataLab