Learn R Programming

DiscriMiner (version 0.1-29)

linDA: Linear Discriminant Analysis

Description

Performs a Linear Discriminant Analysis

Usage

linDA(variables, group, prior = NULL, validation = NULL, learn = NULL, test = NULL, prob = FALSE)

Arguments

variables
matrix or data frame with explanatory variables
group
vector or factor with group memberships
prior
optional vector of prior probabilities. Default prior=NULL implies group proportions
validation
type of validation, either "crossval" or "learntest". Default NULL
learn
optional vector of indices for a learn-set. Only used when validation="learntest". Default NULL
test
optional vector of indices for a test-set. Only used when validation="learntest". Default NULL
prob
logical indicating whether the group classification results should be expressed in probability terms

Value

An object of class "linda", basically a list with the following elements:
functions
table with discriminant functions
confusion
confusion matrix
scores
discriminant scores for each observation
classification
assigned class
error_rate
misclassification error rate

Details

When validation=NULL there is no validation When validation="crossval" cross-validation is performed by randomly separating the observations in ten groups. When validation="learntest" validation is performed by providing a learn-set and a test-set of observations.

References

Lebart L., Piron M., Morineau A. (2006) Statistique Exploratoire Multidimensionnelle. Dunod, Paris.

Saporta G. (2006) Probabilites, analyse des donnees et statistique. Editions Technip, Paris.

Tuffery S. (2011) Data Mining and Statistics for Decision Making. Wiley, Chichester.

See Also

classify, desDA, geoDA, quaDA, plsDA

Examples

Run this code
## Not run: 
#   # load iris dataset
#   data(iris)
# 
#   # linear discriminant analysis with no validation
#   my_lin1 = linDA(iris[,1:4], iris$Species)
#   my_lin1$confusion
#   my_lin1$error_rate
# 
#   # linear discriminant analysis with cross-validation
#   my_lin2 = linDA(iris[,1:4], iris$Species, validation="crossval")
#   my_lin2$confusion
#   my_lin2$error_rate
# 
#   # linear discriminant analysis with learn-test validation
#   learning = c(1:40, 51:90, 101:140)
#   testing = c(41:50, 91:100, 141:150)
#   my_lin3 = linDA(iris[,1:4], iris$Species, validation="learntest", learn=learning, test=testing)
#   my_lin3$confusion
#   my_lin3$error_rate
#   ## End(Not run)

Run the code above in your browser using DataLab