[R] How could I get the percent of variance explained by each axis if I use prcomp to predict new dataset?

Liu, Feng fliu7 at wisc.edu
Thu May 6 00:19:45 CEST 2010


Dear list,

I am trying to use a PCA to predict new dataset, I know how to get the 
variance explained for the original PCA, but how could I get  the 
percent of variance explained by each axis for this new PCA ordination?

Thanks a lot.

x1 <- matrix(rnorm(30), 6, 5)
x2 <- matrix (rnorm(40), 8, 5)
pca1<-prcomp(x1, retx=TRUE)
pca1$sdev
pred <- predict(pca1, x2)


Feng Liu



More information about the R-help mailing list