[R] pca analysis: extract rotated scores?
Liviu Andronic
landronimirc at gmail.com
Tue Nov 30 10:22:34 CET 2010
Dear all
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
version.
data(mtcars)
.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
principal component
mtcars$PC2 <- .PC$scores[,2] # extract un-rotated scores of 2nd
principal component
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,
require(psych)
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
pca
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
one.
Ideas? Thank you
Liviu
--
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail
More information about the R-help
mailing list