#PRINCIPAL COMPONENTS ANALYSIS M=read.table("T8-5.DAT") M attach(M) ?prcomp() PCS = prcomp(M,retx=TRUE,center=TRUE,scale=FALSE) PCS PCS$x PCS$center PCS$scale. biplot(PCS,choices=c(1,2),cex=0.5) biplot(PCS,choices=c(2,3),cex=0.5) biplot(PCS,choices=c(1,3),cex=0.5) plot(PCS) #PCA USING CORRELATION MATRIX PCS = prcomp(M, scale = TRUE) PCS PCS$x PCS$center PCS$scale. biplot(PCS,choices=c(1,2),cex=0.5) # USING ALTERNATE FUNCTION princomp() # NOTE DIFFERENCES IN CALCULATION. # PROTOTYPE BEFORE USING IT! ?princomp