Learn R Programming

DiscriMiner (version 0.1-29)

desDA: Descriptive Discriminant Analysis

Description

Performs a Descriptive Discriminant Analysis (a.k.a. Factorial Discriminant Analysis from the french Analyse Factorielle Discriminante)

Usage

desDA(variables, group, covar = "within")

Arguments

variables
matrix or data frame with explanatory variables
group
vector or factor with group memberships
covar
character string indicating the covariance matrix to be used. Options are "within" and "total"

Value

An object of class "desda", basically a list with the following elements
power
table with discriminant power of the explanatory variables
values
table of eigenvalues
discrivar
table of discriminant variables, i.e. the coefficients of the linear discriminant functions
discor
table of correlations between the variables and the discriminant axes
scores
table of discriminant scores for each observation

Details

When covar="within" the estimated pooled within-class covariance matrix is used in the calculations. When covar="total" the total covariance matrix is used in the calculations. The difference between covar="within" and covar="total" is in the obtained eigenvalues.

The estiamted pooled within-class covariance matrix is actually the within-class covariance matrix divided by the number of observations minus the number of classes (see getWithin)

References

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

See Also

discPower

Examples

Run this code
## Not run: 
#   # load bordeaux wines dataset
#   data(bordeaux)
# 
#   # descriptive discriminant analysis with within covariance matrix
#   my_dda1 = desDA(bordeaux[,2:5], bordeaux$quality)
#   my_dda1
# 
#   # descriptive discriminant analysis with total covariance matrix
#   my_dda2 = desDA(bordeaux[,2:5], bordeaux$quality, covar="total")
#   my_dda2
# 
#   # plot factor coordinates with ggplot
#   library(ggplot2)
#   bordeaux$f1 = my_dda1$scores[,1]
#   bordeaux$f2 = my_dda1$scores[,2]
#   ggplot(data=bordeaux, aes(x=f1, y=f2, colour=quality)) +
#   geom_hline(yintercept=0, colour="gray70") +
#   geom_vline(xintercept=0, colour="gray70") +
#   geom_text(aes(label=year), size=4) +
#   opts(title="Discriminant Map - Bordeaux Wines (years)")
#  ## End(Not run)

Run the code above in your browser using DataLab