[R] Factor Analysis function source code required

Thomas Lumley tlumley at u.washington.edu
Tue Sep 15 19:10:46 CEST 2009


On Tue, 15 Sep 2009, Moumita Das wrote:

> Hi All,
> There were lot of diffrences in the R and SPSS results for Exploratory
> Factor Analysis.why is it so ?I used standard factor analysis functions
> like:--
>
> factanal(m, factors=3, rotation="varimax")
> princomp(m, cor = FALSE, scores = TRUE, subset = rep(TRUE,
> nrow(as.matrix(m))))
> print(summary(princomp(m, cor=TRUE),loadings = TRUE, cutoff = 0.2), digits =
> 2)
> prcomp(m, scale = TRUE)
> summary(pc.cr <- princomp(m, cor=TRUE))
>
> I just do coding in R ,but my statistician said teh results vary a lot.I
> found quite a number of posts regarding this issue in these links:--
> https://stat.ethz.ch/pipermail/r-help/2003-May/033299.html
> https://stat.ethz.ch/pipermail/r-help/2003-May/033361.html
> https://stat.ethz.ch/pipermail/r-help/2003-May/033361.html
> https://stat.ethz.ch/pipermail/r-help/2003-May/033299.html
> http://tolstoy.newcastle.edu.au/R/help/03a/5100.html

That thread is from six years ago. R has changed since that time, and even SPSS might have changed. 
Also, it if you read the thread you see that the SPSS and R principal component output just differ by a 
scale factor on each column of the loadings matrix, which is only defined up to a scale factor.   That 
is, the R and SPSS results actually do agree for principal components.

The factor analysis output may well be different. As the documentation for factanal() says:
"There are so many variations on factor analysis that it is hard to compare output from different 
programs. Further, the optimization in maximum likelihood factor analysis is hard, and many other 
examples we compared had less good fits than produced by this function. In particular, solutions 
which are Heywood cases (with one or more uniquenesses essentially zero) are much often common 
than most texts and some other programs would lead one to believe."

If SPSS and R are fitting the same factor analysis model you can compare the fitted likelihood to see 
which package has found a better solution.

       -thomas

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle




More information about the R-help mailing list