Learn R Programming

rrcov (version 1.7-2)

LdaClassic: Linear Discriminant Analysis

Description

Performs a linear discriminant analysis and returns the results as an object of class LdaClassic (aka constructor).

Usage

LdaClassic(x, ...)

# S3 method for default LdaClassic(x, grouping, prior = proportions, tol = 1.0e-4, ...)

Value

Returns an S4 object of class LdaClassic

Arguments

x

a matrix or data frame containing the explanatory variables (training set).

grouping

grouping variable: a factor specifying the class for each observation.

prior

prior probabilities, default to the class proportions for the training set.

tol

tolerance

...

arguments passed to or from other methods.

Author

Valentin Todorov valentin.todorov@chello.at

References

Todorov V & Filzmoser P (2009), An Object Oriented Framework for Robust Multivariate Analysis. Journal of Statistical Software, 32(3), 1--47. tools:::Rd_expr_doi("10.18637/jss.v032.i03").

See Also

Lda-class, LdaClassic-class,

Examples

Run this code
## Example anorexia
library(MASS)
data(anorexia)

## rrcov: LdaClassic()
lda <- LdaClassic(Treat~., data=anorexia)
predict(lda)@classification

## MASS: lda()
lda.MASS <- lda(Treat~., data=anorexia)
predict(lda.MASS)$class

## Compare the prediction results of MASS:::lda() and LdaClassic()
all.equal(predict(lda)@classification, predict(lda.MASS)$class)

Run the code above in your browser using DataLab