A<-read.table(file="datiRD.txt",header=TRUE) A -------------------------- ## ESEMPIO 1 cor(A) -------------------------- ## ESEMPIO 2 B <- matrix(nrow=27, ncol=5) B[,1] <- A[,1]/A[,5]*1000 B[,2] <- A[,2]/A[,5]*1000 B[,3] <- A[,3]/A[,5]*1000 B[,4] <- A[,4]/A[,5]*1000 B[,5] <- A[,6]/A[,5]*1000 B cor(B) biplot(princomp(B)) ----------------------------- ## ESEMPIO 3 C <- B C[,1] <- (B[,1]-mean(B[,1]))/sd(B[,1]) C[,2] <- (B[,2]-mean(B[,2]))/sd(B[,2]) C[,3] <- (B[,3]-mean(B[,3]))/sd(B[,3]) C[,4] <- (B[,4]-mean(B[,4]))/sd(B[,4]) C[,5] <- (B[,5]-mean(B[,5]))/sd(B[,5]) C cov(C) biplot(princomp(C)) D<-read.table(file="datiRD_stand.txt",header=TRUE) D biplot(princomp(D)) plot(princomp(D)) ----------------------------- ## CLASSIFICAZIONE E<-read.table(file="datiRD_stand_HT.txt",header=TRUE) E biplot(princomp(E)) princomp(E)$loadings E.class <- E E.class[,1] <- 0.276*E[,1]+0.744*E[,2]+0.608*E[,3] E.class[,2] <- 0 E.class[,3] <- 0 E.class