Principal Component Analysis in R
There are, at least :), two ways to compute the principal component analysis of a data set in R. The first one is from scratch computing eigenvectors and eigenvalues. It works as follows # # From scratch # cbind(1:10,1:10 + 0.25*rnorm(10)) -> myData myData - apply(myData,2,mean) -> myDataZM cov(myDataZM) -> cvm eigen(cvm,TRUE) -> eCvm t(eCvm$vector%*%t(myDataZM)) -> newMyData This simple code just transforms the data to align it with the principal components obtained....