Learn R Programming

DiscriMiner (version 0.1-22)

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
  • powertable with discriminant power of the explanatory variables
  • valuestable of eigenvalues
  • discrivartable of discriminant variables, i.e. the coefficients of the linear discriminant functions
  • discortable of correlations between the variables and the discriminant axes
  • scorestable 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
# 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)")

Run the code above in your browser using DataLab