Search code examples
rpsychfactor-analysis

Factor Analysis - Assigning scores by row


I run a factor analysis with fa, I obtained 8 factors (I will use only 5 of them, the ones with SS Loading >1), and now I would like to assign to each row (respondents of my survey) of my original dataset the score of each factor.

Where are the scores stored? How can I create five new columns and assign to each of them the factor score?

CorrMatrix is the Correlation matrix of the items (30x30 matrix)

fa.varimax<-fa(CorrMatrix,nfactors = 8,rotate = "varimax",fm="pa")

the original dataset counts 2994 respondents, one respondent each row

item1 item2 item3 ... item30 1 3 5 ... 4 3 4 2 ... 5

what I would like to do is to add at the end of the original dataset five new columns

factor1 factor2 factor3 factor4 factor5
score1i score2i score3i score4i score5i
score1j score2j score3j score4j score5j

for all the 2994 respondents


Solution

  • Assuming you are using the psych library as the question did not state. The SS loadings are not directly stored in the factor-analysis, but can be calculated.

    library(psych)
    
    fa.loadings <- colSums(fa.varimax$loadings ^ 2)  # calculate factor loading
    fa.loadings <- fa.loadings[fa.loadings > 1]  # filter factor loading
    

    Reference: https://web.stanford.edu/class/psych253/tutorials/FactorAnalysis.html