[R] calculate factor scores

David L Carlson dcarlson at tamu.edu
Mon Nov 9 22:26:07 CET 2015


I think you can use predict.psych() in package psych. Since you analyzed a correlation matrix with fa() it does not have access to the original data. 

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352


-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of David Studer
Sent: Monday, November 9, 2015 8:42 AM
To: r-help at r-project.org
Subject: [R] calculate factor scores

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]]

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.



More information about the R-help mailing list