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/ ______________________________________________ [hidden email] 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. |
Finn,
>> 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: < ...snip... > >> So what is wrong with the rotations and what is wrong with 'principal'? I would say that nothing is wrong. Right at the top of the help file for principal() [3rd line down] Professor Revelle notes that "The eigen vectors are rescaled by the sqrt of the eigen values to produce the component loadings more typical in factor analysis." You talk about differences and results not "quite" corresponding. But what actually are these differences? and what are their magnitudes? In cases like this, where you are questioning well-tested functions you would be well advised to give concrete examples, accompanied by code that users can run without having to grub around your questions. Regards, Mark.
Mark Difford (Ph.D.)
Research Associate Botany Department Nelson Mandela Metropolitan University Port Elizabeth, South Africa |
Powered by Nabble | Edit this page |