[R] calculate factor scores
David Studer
studerov at gmail.com
Mon Nov 9 15:41:54 CET 2015
Hello everybody,
I have a problem regarding factor analysis:
As I am using the hetmat()-function from the polycor-package in order to
calculate different kinds of correlation coefficients automatically* I
cannot obtain
factor scores using fit$scores. The problem is that I am using the
fa()-function
with a correlation table (structural level) instead of raw data.
Can anyone help me in calculating factor scores ex post?
Thank you for any hints!
David
--
Here's the code:
# select variables
df<-data[c("var1", "var2", "var3", "var4", "var5", "var6")]
# compute heterogenous correlation matrix
library(polycor)
hetmat<-hetcor(df)$cor
# factor analysis
library(psych)
fa.parallel(hetmat) # number of factors?
fit<-fa(hetmat, nfactors=4, fm="ml", rotate="varimax") # factor analysis
colnames(fit$loadings)<-c("Factor1","Factor2","Factor3","Factor4")
fit$scores???
[[alternative HTML version deleted]]
More information about the R-help
mailing list