Francesco Savorani wrote: > I'm handling a matrix dataset composed by a number of variables much > higher than the objects (900 vs 100) and performing a prcomp > (centered and scaled) PCA on it. What I get is a Loadings (rotation) > matrix limited by my lower number of objects and thus 900x100 > instead of 900x900. If I try to manually calculate the matrix scores > multiplying the original variables (centered and scaled) for such a > loadings matrix I cannot obtain the same values calculated by R and > stored on the prcomp$x matrix (100x100).
This works for me: M <- matrix(rnorm(900*100), ncol = 900) pca <- prcomp(M, scale = TRUE) S <- scale(M) %*% pca$rotation all.equal(S, pca$x) ## => TRUE -- Bjørn-Helge Mevik ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
