[R] Factor rotation (e.g., oblimin, varimax) and PCA
Finn Aarup Nielsen
fn at imm.dtu.dk
Thu Jan 27 00:11:04 CET 2011
A bit of a newbee to R and factor rotation I am trying to understand
factor rotations and their implementation in R, particularly the
GPArotation library.
I have tried to reproduce some of the examples that I have found, e.g., I
have taken the values from Jacksons example in "Oblimin Rotation",
Encyclopedia of Biostatistics
http://onlinelibrary.wiley.com/doi/10.1002/0470011815.b2a13060/abstract
and run it through R:
library(GPArotation)
data <- matrix(c(0.6, 0.39, 0.77, 0.70, 0.64, 0.35, 0.52, 0.72, 0.34,
0.58, 0.15, 0.07, -0.13, -0.23, -0.23, 0.67, -0.27, -0.23, 0.72,
0.20, 0.41, 0.55, -0.10, -0.06, -0.21, -0.33, -0.27, -0.20, -0.22, 0.47), 10, 3)
oblimin(data)
The values I get out do not quite correspond to the values given in the
table. What could this difference be due to? Rounding in the initial data?
Or implementation details of the R oblimin function in GPArotation?
Jackson writes about 'raw oblimin', 'normal oblimin' and 'direct oblimin'
and I do not know how that relates to the R oblimin implementation.
I have also tried varimax on data and results given by Mardia in his
'Multivariate analysis' book Table 9.4.1. Mardia uses the communalities
from the factor analysis in the expression for the varimax rotation. I
dont see how the R varimax function can handle the communalities. I dont
have the book right at hand, but I believe this R code represents
Mardia examples in R:
lambda <- matrix(c(0.628, 0.696, 0.899, 0.779, 0.728,
0.372, 0.313, -0.050, -0.201, -0.200), 5, 2)
varimax(lambda)
I do not get the result that Mardia presents.
I was about to use the factor rotation on the loadings from a principal
component analysis and I saw that the 'principal' from the 'psych' library
has a (some kind of) PCA with rotation. But when I use 'principal' I do
not seem to be able to get the same results from prcomp and princomp and a
'raw' use of eigen:
library(GPArotation)
library(psych)
# These 3 lines gives the same result
prcomp(answers)$r[1:2,1:3]
princomp(answers, cor=FALSE)$l[1:2,1:3]
eigen(cov(answers))$ve[1:2,1:3]
# These 3 lines gives the same result
prcomp(answers, center=TRUE, scale=TRUE)$r[1:2,1:3]
princomp(answers, cor=TRUE)$l[1:2,1:3]
eigen(cor(answers))$ve[1:2,1:3]
# This gives another result
principal(answers, nfactors=3, rotate="none")$l[1:2,1:3]
Furthermore, I tried to use oblimin on the PCA loadings via prcomp and
'principal', but they give different results:
# These 2 lines give different results
oblimin(prcomp(answers, center=TRUE, scale=TRUE)$r[,1:3])$l[1:2,]
principal(answers, nfactors=3, rotate="oblimin")$l[1:2,1:3]
So what is wrong with the rotations and what is wrong with 'principal'?
How do the different oblimin methods relate to the implementation in R
GPArotation?
/Finn
___________________________________________________________________
Finn Aarup Nielsen, DTU Informatics, Denmark
Lundbeck Foundation Center for Integrated Molecular Brain Imaging
http://www.imm.dtu.dk/~fn/ http://nru.dk/staff/fnielsen/
More information about the R-help
mailing list