Advanced Statistics - Biology 6030

Bowling Green State University, Fall 2017

Discriminant Function Analysis

Discriminant Analysis (DA) is a statistical technique that examines a set of independent (i.e., predictor) variables in order to predict or explain a nonmetric dependent (i.e., criterion, grouping) variable (with two or more a priori categories).

DA is used in the situation where group membership is known for a set of individuals and where we have obtained a variety of measures from each individual. Recall our discussions on Multiple Linear Regression Analysis, where we developed an equation that summarized the relationship between a dependent and a set of independent variables. Similarly, DA obtains an equation that best separates members of the groups.




How this is done

Analysis Detail

In R you first need to import datafile "BodyMeasures.txt", define n to represent the sample size, and group your response variables into a set using cbind.

> bodyMeasures <- read.table("/BodyMeasures.txt", header=TRUE, sep=",", na.strings="NA", dec=".")
> bodyMeasures$Ys <- with(bodyMeasures,cbind(Mass,Fore,Bicep,Chest,Neck,Shoulder,Waist,Height,Calf,Thigh,Head))

Make sure you have library MASS installed and perform a Linear Discriminant Analysis. CV=TRUE generates jacknifed (i.e., leave one out) predictions

> library(MASS)
> fit_LDA <- lda(Sex ~ Ys, data = bodyMeasures, CV=TRUE)
> fit_LDA
> summary(fit_LDA)
> plot(fit_LDA)

Now assess the accuracy of the prediction by testing for the percent of the cases that are classified correctly, and the total percent correct

> ct <- table(bodyMeasures$Sex, fit_LDA$class)
> diag(prop.table(ct, 1))
> sum(diag(prop.table(ct)))

Display the results of a linear classifications two variables at a time.

> install.packages("klaR")
> library(klaR)
> partimat(Sex ~ Ys, data = bodyMeasures, method="lda")

last modified: 4/14/10
This material is copyrighted and MAY NOT be used for commercial purposes, 2001-2017 lobsterman.
[ Advanced Statistics Course page | About BIO 6030 | Announcements ]
[ Course syllabus | Exams & Grading | Glossary | Evaluations | Links ]