[R] factanal prediction
John Fox
jfox at mcmaster.ca
Wed Apr 10 15:04:54 CEST 2002
At 12:16 PM 4/9/2002 -0400, Christopher Fonnesbeck wrote:
>I was wondering if there is a way of predicting factor scores of new
>data for factor analysis in R (similar to "predict" in S-plus). So far I
>have not been able to find it, nor found reference to it.
Dear Chris,
The problem is that factanal doesn't save the factor-score coefficients
(even if you ask for factor scores). It's not hard to recompute these. For
example, for the "regression" method with orthogonally rotated factors and
standardized variables, the factor score coefficients are
coef <- solve(obj$correlation) %*% obj$loadings
where obj is the object returned by factanal. Then you can calculate the
predicted factor scores as
scale(newdata, means, sds) %*% coef
where the means and standard deviations used to standardize the "new" data
are from the data used to do the factor analysis.
I hope that this does what you need,
John
-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
-----------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list