library(DAAG) possum.dat<-na.omit(possum[,6:14]) cov(possum.dat) diag(cov(possum.dat)) cor(possum.dat) possum.prc<-prcomp(possum.dat,scale=T) summary(possum.prc) par(mfrow=c(1,2)) screeplot(possum.prc) screeplot(possum.prc,type="line") possum.prc predict(possum.prc)[,1:2] library(MASS) here <- !is.na(possum$footlgth) possum.lda <- lda(site ~ hdlngth+skullw+totlngth+ taill+footlgth+earconch+eye+chest+belly, data=possum, subset=here) possum.lda options(digits=4) possum.lda$svd # Examine the singular values plot(possum.lda, dimen=3) predict(possum.lda)$class tab<-table(possum[here,]$site,predict(possum.lda)$class) tab sum(diag(tab))/sum(tab) possum.lda.cv <- lda(site ~ hdlngth+skullw+totlngth+ taill+footlgth+earconch+eye+chest+belly, data=possum, subset=here, CV=T) tab.cv<-table(possum[here,]$site,possum.lda.cv$class) tab.cv sum(diag(tab.cv))/sum(tab.cv)