#R code example 81
xx=read.table('D:/T1-9.DAT')
xx[1:2,]
result=princomp(xx[,1:7],cor=TRUE, score=T)
summary(result, loadings=T)
result$loadings
yy=result$scores
yy
screeplot(result)
plot(result)
biplot(result)
qqnorm(yy[,1],
par(mfrow=c(1,2))
qqnorm(-yy[,1],main="scores w.r.t Princom1",sub="\nQ-Q plot with line",ylab="scores")
qqline(-yy[,1],col="red")
qqplot(rnorm(length(yy[,1])), -yy[,1],col="blue",xlab="normal points",ylab="scores", main="scores w.r.t Princom1")
plot(xx[,1],xx[,2], type="n", xlab="m100", ylab="m200")
title("scatter plot of m100 and m200")
text(xx[,1], xx[,2], labels=xx[,8],cex=0.5,col="blue")
plot(-yy[,1],yy[,2], type="n", xlab="princomp1", ylab="princomp2")
title("Princomp1 versus Princomp2")
text(-yy[,1], yy[,2], labels=xx[,8],cex=0.5,col="red")
plot(yy[,5],yy[,6], type="n", xlab="princomp5", ylab="princomp6")
title("Princomp5 versus Princomp6")
text(yy[,5], yy[,6], labels=xx[,8],cex=0.5,col="blue")
plot(yy[,6],yy[,7], type="n", xlab="princomp6", ylab="princomp7")
title("Princomp6 versus Princomp7")
text(yy[,6], yy[,7], labels=xx[,8],cex=0.5,col="red")