# Script for DFA from Davis and McHorse, 2013. Palaeo Electronica. # "A method for improved identification of postrcania from mammalian fossil assemblages: multivariate discriminant function analysis of camelid astragali." # Genus-level DFA with Jackknife; change first term of the lda command to call another column to run Species or Lumped analysis # Change CV = FALSE to run analysis without Jackknife. # Prior is specified to be uninformative; if not included, default prior is set by relative abundances in the training set. # For data, save the data file (Appendix 1) as a .csv file. rm() setwd("Filepath") camels <- read.csv("data.csv",header=T) library(MASS) fit <- lda(Genus..2. ~ LM + TD + TI + TP + LL + WD + WI + LI, data=camels, prior= c(1,1,1,1,1)/5, na.action="na.omit", CV=TRUE) fit # show results # Assess the accuracy of the prediction # percent correct for each category of G ct <- table(camels$Genus..2., fit$class) diag(prop.table(ct, 1)) # total percent correct sum(diag(prop.table(ct))) # diagonal table of IDs ct