Search code examples
rpsychfactor-analysis

psych - Getting cumulative Variance from fa loadings


I am using the psych package's fa command for factor analysis, and so have an object of class fa. I can query the loadings with fac$loadings,but how can I capture the bottom half of the loadings, which gives the SS loadings and the Proportion and cumulative Variance.

Example code:

library(psych)
data(bfi)
fac <- fa(r=cor(bfi, use="complete.obs"), nfactors=5, fm="ml", rotate="none")
fac$loadings

And how can I extract the follow information?

                 ML1   ML2   ML3   ML4   ML5
SS loadings    4.429 2.423 1.562 1.331 0.966
Proportion Var 0.158 0.087 0.056 0.048 0.034
Cumulative Var 0.158 0.245 0.301 0.348 0.383

Solution

  • After running str(fac) it seems that you can get the data you're interested in with

    df <- fac$Vaccounted
    > df
                                ML1        ML2       ML3       ML4        ML5
    SS loadings           4.4291169 2.42278894 1.5623383 1.3308373 0.96561620
    Proportion Var        0.1581827 0.08652818 0.0557978 0.0475299 0.03448629
    Cumulative Var        0.1581827 0.24471092 0.3005087 0.3480386 0.38252492
    Proportion Explained  0.4135227 0.22620272 0.1458671 0.1242531 0.09015437
    Cumulative Proportion 0.4135227 0.63972545 0.7855925 0.9098456 1.00000000