[R] pca analysis: extract rotated scores?
landronimirc at gmail.com
Tue Nov 30 10:22:34 CET 2010
I'm unable to find an example of extracting the rotated scores of a
principal components analysis. I can do this easily for the un-rotated
.PC <- princomp(~am+carb+cyl+disp+drat+gear+hp+mpg, cor=TRUE, data=mtcars)
unclass(loadings(.PC)) # component loadings
summary(.PC) # proportions of variance
mtcars$PC1 <- .PC$scores[,1] # extract un-rotated scores of 1st
mtcars$PC2 <- .PC$scores[,2] # extract un-rotated scores of 2nd
head(mtcars[, c('PC1', 'PC2')])
However, I no longer understand how to do so if I want to use
?principal in 'psych' and any of the GPArotation methods. For example,
r <- cor(mtcars[,c("am","carb","cyl","disp","drat","gear","hp","mpg")])
pca <- principal(r, nfactors = 8, residuals = T, rotate="none") # or
'varimax' or any other GPArotation supported rotation
I've turned the 'pca' object and ?principal help page upside down and
I still cannot find anything that would resemble a 'scores' value. I'm
pretty sure it's one matrix computation away, but I cannot find which
Ideas? Thank you
Do you know how to read?
Do you know how to write?
More information about the R-help