Factor Analysis in R

[This article was first published on Jeromy Anglim's Blog: Psychology and Statistics, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This post shows an example of running a basic factor analysis in R.
Additional Resources:

The Example:
The example is based on responses by 117 university students to a 50 item version of the IPIP.

# Required packages.<br />require(psych);<br />require(foreign);<br /><br /># Import data from SPSS data file.<br />personality <- foreign::read.spss("spss\personality.sav", <br />    to.data.frame = TRUE)<br /><br /># Factor analysis.<br />items <- c("ipip1", "ipip2", "ipip3", "ipip4", "ipip5", <br />    "ipip6", "ipip7", "ipip8", "ipip9", "ipip10", "ipip11", <br />    "ipip12", "ipip13", "ipip14", "ipip15", "ipip16", "ipip17", <br />    "ipip18", "ipip19", "ipip20", "ipip21", "ipip22", "ipip23", <br />    "ipip24", "ipip25", "ipip26", "ipip27", "ipip28", "ipip29", <br />    "ipip30", "ipip31", "ipip32", "ipip33", "ipip34", "ipip35", <br />    "ipip36", "ipip37", "ipip38", "ipip39", "ipip40", "ipip41", <br />    "ipip42", "ipip43", "ipip44", "ipip45", "ipip46", "ipip47", <br />    "ipip48", "ipip49", "ipip50") ;<br /><br /># Descriptive Statistics.<br />itemDescriptiveStatistics <- sapply(personality[items], <br />    function(x) c(mean=mean(x), sd=sd(x), n = length(x)));<br />cbind(attr(personality, "variable.labels")[items], <br />    round(t(itemDescriptiveStatistics), 2) );<br /><br /># Scree plot.<br />psych::VSS.scree(cor(personality[items]));<br /><br /># Some other indicators of the number of factors.<br />psych::VSS(cor(personality[items]), 10, <br />    n.obs = nrow(personality), rotate = "promax");<br /><br /># Communalities<br />itemCommunalities <- 1 - dataForScreePlot$uniquenesses;<br />round(cbind(itemCommunalities), 2);<br /><br /># List items with low communalities.<br />itemsWithLowCommunalities <- names(itemCommunalities[<br />        itemCommunalities < .25]);<br />cat("Items with low communalities (< .25)n");<br />problematicItemText <- attr(personality, <br />    "variable.labels")[itemsWithLowCommunalities ];<br />problematicItemCommunalities <- round(itemCommunalities[<br />        itemsWithLowCommunalities],3);<br />data.frame(itemText = problematicItemText, <br />    communality = problematicItemCommunalities);<br /><br /><br /># Variance explained by each factor before rotation. <br /># (see Proportion Var)<br />factanal(personality[items], factors = 5, rotation = "none");<br /><br /># Variance explained by each factor after rotatoin. <br /># (see Proportion Var)<br />factanal(personality[items], factors = 5, rotation = "promax");<br /><br /># Loadings prior to rotation.<br />fitNoRotation <- factanal(personality[items], <br />    factors = 5, rotation = "none");<br />print(fitNoRotation$loadings, cutoff = .30, sort = TRUE);<br /><br /># Loadings after rotation.<br />fitAfterRotation <- factanal(personality[items], <br />    factors = 5, rotation = "promax");<br />print(fitAfterRotation$loadings, cutoff = .30, sort = TRUE);<br /><br /># Correlations between factors <br /># This assumes use of a correlated rotation method such as promax<br />factorCorrelationsRegression <- cor(factanal(<br />        personality[items],  factors = 5, <br />        rotation = "promax", scores = "regression")$scores);<br />round(factorCorrelationsRegression,2);<br />

And this is what the output looks like. If you copy and paste the output into a text editor like Notepad, it will look prettier.

> # Required packages.<br />> require(psych);<br />> require(foreign);<br />> <br />> # Import data from SPSS data file.<br />> personality <- foreign::read.spss("spss\personality.sav", <br />+     to.data.frame = TRUE)<br />> <br />> # Factor analysis.<br />> items <- c("ipip1", "ipip2", "ipip3", "ipip4", "ipip5", <br />+     "ipip6", "ipip7", "ipip8", "ipip9", "ipip10", "ipip11", <br />+     "ipip12", "ipip13", "ipip14", "ipip15", "ipip16", "ipip17", <br />+     "ipip18", "ipip19", "ipip20", "ipip21", "ipip22", "ipip23", <br />+     "ipip24", "ipip25", "ipip26", "ipip27", "ipip28", "ipip29", <br />+     "ipip30", "ipip31", "ipip32", "ipip33", "ipip34", "ipip35", <br />+     "ipip36", "ipip37", "ipip38", "ipip39", "ipip40", "ipip41", <br />+     "ipip42", "ipip43", "ipip44", "ipip45", "ipip46", "ipip47", <br />+     "ipip48", "ipip49", "ipip50") ;<br />> <br />> # Descriptive Statistics.<br />> itemDescriptiveStatistics <- sapply(personality[items], <br />+     function(x) c(mean=mean(x), sd=sd(x), n = length(x)));<br />> cbind(attr(personality, "variable.labels")[items], <br />+     round(t(itemDescriptiveStatistics), 2) );<br />                                                                      mean   sd     n    <br />ipip1  "Q1. I Am the life of the party                              " "2.84" "1.2"  "117"<br />ipip2  "Q2. I Feel little concern for others"                         "1.58" "0.9"  "117"<br />ipip3  "Q3. I Am always prepared"                                     "3.25" "1.13" "117"<br />ipip4  "Q4. I Get stressed out easily"                                "3.35" "1.32" "117"<br />ipip5  "Q5. I Have a rich vocabulary"                                 "3.61" "1.06" "117"<br />ipip6  "Q6. I Dont talk a lot"                                        "2.38" "1.2"  "117"<br />ipip7  "Q7. I Am interested in people"                                "4.4"  "0.78" "117"<br />ipip8  "Q8. I Leave my belongings around"                             "2.69" "1.42" "117"<br />ipip9  "Q9. I Am relaxed most of the time"                            "3.27" "1.08" "117"<br />ipip10 "Q10. I Have difficulty understanding abstract ideas"          "2.08" "1.03" "117"<br />ipip11 "Q11. I Feel comfortable around people"                        "3.91" "1.02" "117"<br />ipip12 "Q12. I Insult people"                                         "1.94" "1.12" "117"<br />ipip13 "Q13. I Pay attention to details"                              "3.91" "0.96" "117"<br />ipip14 "Q14. I Worry about things"                                    "3.7"  "1.04" "117"<br />ipip15 "Q15. I Have a vivid imagination"                              "3.94" "1.07" "117"<br />ipip16 "Q16. I Keep in the background"                                "2.74" "1.25" "117"<br />ipip17 "Q17. I Sympathize with others feelings"                       "4.38" "0.65" "117"<br />ipip18 "Q18. I Make a mess of things"                                 "2.42" "1.04" "117"<br />ipip19 "Q19. I Seldom feel blue"                                      "2.92" "1.16" "117"<br />ipip20 "Q20. I Am not interested in abstract ideas"                   "2.01" "1.05" "117"<br />ipip21 "Q21. I Start conversations"                                   "3.65" "1.1"  "117"<br />ipip22 "Q22. I Am not interested in other peoples problems"           "1.68" "0.8"  "117"<br />ipip23 "Q23. I Get chores done right away"                            "2.82" "1.23" "117"<br />ipip24 "Q24. I Am easily disturbed"                                   "3.09" "1.22" "117"<br />ipip25 "Q25. I Have excellent ideas"                                  "3.75" "0.94" "117"<br />ipip26 "Q26. I Have little to say"                                    "2.08" "1"    "117"<br />ipip27 "Q27. I Have a soft heart"                                     "4.15" "0.88" "117"<br />ipip28 "Q28. I Often forget to put things back in their proper place" "2.56" "1.28" "117"<br />ipip29 "Q29. I Get upset easily"                                      "2.87" "1.31" "117"<br />ipip30 "Q30. I Do not have a good imagination"                        "1.9"  "0.99" "117"<br />ipip31 "Q31. I Talk to a lot of different people at parties"          "3.23" "1.3"  "117"<br />ipip32 "Q32. I Am not really interested in others"                    "1.7"  "0.75" "117"<br />ipip33 "Q33. I Like order"                                            "3.67" "1.07" "117"<br />ipip34 "Q34. I Change my mood a lot"                                  "3.15" "1.21" "117"<br />ipip35 "Q35. I Am quick to understand things"                         "3.85" "0.94" "117"<br />ipip36 "Q36. I Dont like to draw attention to myself"                 "3.06" "1.22" "117"<br />ipip37 "Q37. I Take time out for others"                              "4.12" "0.83" "117"<br />ipip38 "Q38. I Shirk my duties"                                       "2.32" "1.06" "117"<br />ipip39 "Q39. I Have frequent mood swings"                             "2.88" "1.31" "117"<br />ipip40 "Q40. I Use difficult words"                                   "3.18" "1.16" "117"<br />ipip41 "Q41. I Dont mind being the center of attention"               "3.25" "1.29" "117"<br />ipip42 "Q42. I Feel others emotions"                                  "4.21" "0.64" "117"<br />ipip43 "Q43. I Follow a schedule"                                     "3.44" "1.13" "117"<br />ipip44 "Q44. I Get irritated easily"                                  "2.94" "1.21" "117"<br />ipip45 "Q45. I Spend time reflecting on things"                       "4.15" "0.91" "117"<br />ipip46 "Q46. I Am quiet around strangers"                             "3.21" "1.33" "117"<br />ipip47 "Q47. I Make people feel at ease"                              "3.73" "0.89" "117"<br />ipip48 "Q48. I Am exacting in my work"                                "3.63" "0.92" "117"<br />ipip49 "Q49. I Often feel blue"                                       "2.36" "1.27" "117"<br />ipip50 "Q50. I Am full of ideas"                                      "3.81" "0.96" "117"<br />> <br />> # Scree plot.<br />> psych::VSS.scree(cor(personality[items]));<br />> <br />> # Some other indicators of the number of factors.<br />> psych::VSS(cor(personality[items]), 10, <br />+     n.obs = nrow(personality), rotate = "promax");<br /><br />Very Simple Structure<br />VSS complexity 1 achieves a maximimum of 0.64  with  6  factors<br />VSS complexity 2 achieves a maximimum of 0.74  with  4  factors<br /><br />The Velicer MAP criterion achieves a minimum of 0.04  with  6  factors<br /> <br />Velicer MAP<br /> [1] 0.04 0.04 0.03 0.02 0.02 0.02 0.02 0.02 0.02 0.02<br /><br />Very Simple Structure Complexity 1<br /> [1] 0.43 0.48 0.57 0.64 0.64 0.64 0.60 0.61 0.64 0.61<br /><br />Very Simple Structure Complexity 2<br /> [1] 0.00 0.55 0.67 0.74 0.74 0.73 0.71 0.73 0.71 0.71<br />> <br />> # Communalities<br />> itemCommunalities <- 1 - dataForScreePlot$uniquenesses;<br />> round(cbind(itemCommunalities), 2);<br />       itemCommunalities<br />ipip1               0.72<br />ipip2               0.19<br />ipip3               0.40<br />ipip4               0.77<br />ipip5               0.59<br />ipip6               0.70<br />ipip7               0.58<br />ipip8               0.62<br />ipip9               0.49<br />ipip10              0.46<br />ipip11              0.56<br />ipip12              0.27<br />ipip13              0.46<br />ipip14              0.75<br />ipip15              0.75<br />ipip16              0.75<br />ipip17              0.45<br />ipip18              0.55<br />ipip19              0.60<br />ipip20              0.47<br />ipip21              0.68<br />ipip22              0.43<br />ipip23              0.59<br />ipip24              0.41<br />ipip25              0.68<br />ipip26              0.77<br />ipip27              0.53<br />ipip28              0.54<br />ipip29              0.75<br />ipip30              0.80<br />ipip31              0.73<br />ipip32              0.41<br />ipip33              0.44<br />ipip34              0.92<br />ipip35              0.53<br />ipip36              0.63<br />ipip37              0.25<br />ipip38              0.34<br />ipip39              0.72<br />ipip40              1.00<br />ipip41              0.80<br />ipip42              0.64<br />ipip43              0.49<br />ipip44              0.65<br />ipip45              0.37<br />ipip46              0.52<br />ipip47              0.47<br />ipip48              0.44<br />ipip49              0.82<br />ipip50              0.75<br />> <br />> # List items with low communalities.<br />> itemsWithLowCommunalities <- names(itemCommunalities[<br />+         itemCommunalities < .25]);<br />> cat("Items with low communalities (< .25)n");<br />Items with low communalities (< .25)<br />> problematicItemText <- attr(personality, <br />+     "variable.labels")[itemsWithLowCommunalities ];<br />> problematicItemCommunalities <- round(itemCommunalities[<br />+         itemsWithLowCommunalities],3);<br />> data.frame(itemText = problematicItemText, <br />+     communality = problematicItemCommunalities);<br />                                   itemText communality<br />ipip2  Q2. I Feel little concern for others       0.187<br />ipip37      Q37. I Take time out for others       0.249<br />> <br />> <br />> # Variance explained by each factor before rotation. <br />> # (see Proportion Var)<br />> factanal(personality[items], factors = 5, rotation = "none");<br /><br />Call:<br />factanal(x = personality[items], factors = 5, rotation = "none")<br /><br />Uniquenesses:<br /> ipip1  ipip2  ipip3  ipip4  ipip5  ipip6  ipip7  ipip8  ipip9 ipip10 ipip11 ipip12 ipip13 ipip14 ipip15 ipip16 ipip17 ipip18 ipip19 ipip20 ipip21 ipip22 ipip23 ipip24 ipip25 <br /> 0.345  0.873  0.644  0.367  0.819  0.414  0.480  0.529  0.590  0.537  0.458  0.789  0.645  0.431  0.504  0.266  0.535  0.519  0.619  0.506  0.347  0.615  0.484  0.615  0.329 <br />ipip26 ipip27 ipip28 ipip29 ipip30 ipip31 ipip32 ipip33 ipip34 ipip35 ipip36 ipip37 ipip38 ipip39 ipip40 ipip41 ipip42 ipip43 ipip44 ipip45 ipip46 ipip47 ipip48 ipip49 ipip50 <br /> 0.480  0.613  0.556  0.293  0.421  0.298  0.592  0.600  0.372  0.637  0.541  0.775  0.735  0.434  0.846  0.457  0.408  0.508  0.370  0.699  0.499  0.580  0.715  0.397  0.264 <br /><br />Loadings:<br />       Factor1 Factor2 Factor3 Factor4 Factor5<br />ipip1  -0.679           0.403          -0.166 <br />ipip2          -0.293   0.120          -0.131 <br />ipip3  -0.173                   0.564         <br />ipip4   0.517   0.251   0.510   0.203         <br />ipip5  -0.212   0.266  -0.151   0.156  -0.136 <br />ipip6   0.634          -0.419                 <br />ipip7  -0.448   0.362   0.123           0.415 <br />ipip8           0.146   0.193  -0.632         <br />ipip9  -0.404  -0.268  -0.298  -0.292         <br />ipip10  0.215  -0.370   0.427           0.308 <br />ipip11 -0.641  -0.101   0.342                 <br />ipip12                  0.323          -0.294 <br />ipip13          0.255  -0.295   0.445         <br />ipip14  0.538   0.163   0.380   0.294   0.147 <br />ipip15 -0.149   0.646  -0.159  -0.156         <br />ipip16  0.762          -0.352           0.151 <br />ipip17          0.386                   0.546 <br />ipip18  0.181   0.162   0.284  -0.583         <br />ipip19 -0.446  -0.206  -0.347           0.103 <br />ipip20  0.124  -0.523   0.348   0.117   0.265 <br />ipip21 -0.646           0.476                 <br />ipip22  0.291  -0.414                  -0.352 <br />ipip23 -0.286  -0.145  -0.172   0.616         <br />ipip24  0.467   0.166   0.339  -0.158         <br />ipip25 -0.396   0.553  -0.416          -0.182 <br />ipip26  0.662          -0.254                 <br />ipip27 -0.176   0.385   0.214           0.401 <br />ipip28          0.104          -0.623   0.178 <br />ipip29  0.605   0.206   0.505   0.204         <br />ipip30  0.278  -0.649   0.231   0.138         <br />ipip31 -0.661  -0.192   0.472                 <br />ipip32  0.344  -0.388          -0.145  -0.331 <br />ipip33                          0.619  -0.103 <br />ipip34  0.425   0.421   0.500          -0.139 <br />ipip35 -0.425   0.306  -0.229   0.186         <br />ipip36  0.538  -0.102  -0.314           0.243 <br />ipip37 -0.307   0.230                   0.264 <br />ipip38  0.216           0.108  -0.444         <br />ipip39  0.376   0.391   0.469          -0.228 <br />ipip40 -0.160   0.221           0.174  -0.208 <br />ipip41 -0.546           0.437          -0.224 <br />ipip42 -0.231   0.553           0.191   0.440 <br />ipip43                          0.676  -0.158 <br />ipip44  0.498   0.362   0.477          -0.129 <br />ipip45  0.178   0.495           0.143         <br />ipip46  0.557          -0.393           0.162 <br />ipip47 -0.500                           0.408 <br />ipip48                 -0.142   0.509         <br />ipip49  0.619   0.304   0.318          -0.160 <br />ipip50 -0.347   0.681  -0.318  -0.101  -0.200 <br /><br />               Factor1 Factor2 Factor3 Factor4 Factor5<br />SS loadings      8.281   4.755   4.553   3.899   2.162<br />Proportion Var   0.166   0.095   0.091   0.078   0.043<br />Cumulative Var   0.166   0.261   0.352   0.430   0.473<br /><br />Test of the hypothesis that 5 factors are sufficient.<br />The chi square statistic is 1389.91 on 985 degrees of freedom.<br />The p-value is 2.3e-16 <br />> <br />> # Variance explained by each factor after rotatoin. <br />> # (see Proportion Var)<br />> factanal(personality[items], factors = 5, rotation = "promax");<br /><br />Call:<br />factanal(x = personality[items], factors = 5, rotation = "promax")<br /><br />Uniquenesses:<br /> ipip1  ipip2  ipip3  ipip4  ipip5  ipip6  ipip7  ipip8  ipip9 ipip10 ipip11 ipip12 ipip13 ipip14 ipip15 ipip16 ipip17 ipip18 ipip19 ipip20 ipip21 ipip22 ipip23 ipip24 ipip25 <br /> 0.345  0.873  0.644  0.367  0.819  0.414  0.480  0.529  0.590  0.537  0.458  0.789  0.645  0.431  0.504  0.266  0.535  0.519  0.619  0.506  0.347  0.615  0.484  0.615  0.329 <br />ipip26 ipip27 ipip28 ipip29 ipip30 ipip31 ipip32 ipip33 ipip34 ipip35 ipip36 ipip37 ipip38 ipip39 ipip40 ipip41 ipip42 ipip43 ipip44 ipip45 ipip46 ipip47 ipip48 ipip49 ipip50 <br /> 0.480  0.613  0.556  0.293  0.421  0.298  0.592  0.600  0.372  0.637  0.541  0.775  0.735  0.434  0.846  0.457  0.408  0.508  0.370  0.699  0.499  0.580  0.715  0.397  0.264 <br /><br />Loadings:<br />       Factor1 Factor2 Factor3 Factor4 Factor5<br />ipip1   0.811                                 <br />ipip2   0.165                  -0.167  -0.249 <br />ipip3                   0.562           0.139 <br />ipip4           0.770          -0.192   0.141 <br />ipip5                   0.184   0.344         <br />ipip6  -0.730                   0.119         <br />ipip7   0.177                           0.636 <br />ipip8   0.164          -0.672   0.148         <br />ipip9          -0.601  -0.200          -0.136 <br />ipip10          0.157          -0.675   0.173 <br />ipip11  0.655  -0.112          -0.127   0.144 <br />ipip12  0.411   0.224                  -0.298 <br />ipip13 -0.181           0.464   0.255         <br />ipip14 -0.148   0.636   0.170  -0.289   0.209 <br />ipip15          0.108  -0.176   0.646   0.160 <br />ipip16 -0.831                                 <br />ipip17 -0.150          -0.102           0.725 <br />ipip18          0.201  -0.648                 <br />ipip19         -0.560   0.158                 <br />ipip20  0.106                  -0.726         <br />ipip21  0.736                  -0.137   0.226 <br />ipip22                         -0.137  -0.566 <br />ipip23  0.109  -0.147   0.674                 <br />ipip24          0.498  -0.239                 <br />ipip25         -0.181           0.765         <br />ipip26 -0.630                          -0.133 <br />ipip27          0.152  -0.117           0.602 <br />ipip28                 -0.680           0.138 <br />ipip29          0.808          -0.195         <br />ipip30                  0.143  -0.705  -0.166 <br />ipip31  0.831                  -0.161         <br />ipip32 -0.122                          -0.560 <br />ipip33          0.131   0.644                 <br />ipip34  0.111   0.795  -0.115   0.102         <br />ipip35         -0.176   0.195   0.341   0.218 <br />ipip36 -0.681                  -0.194         <br />ipip37  0.134                           0.409 <br />ipip38 -0.113          -0.486                 <br />ipip39  0.162   0.761           0.152         <br />ipip40  0.237   0.195   0.190   0.243         <br />ipip41  0.772   0.153                         <br />ipip42          0.127           0.126   0.722 <br />ipip43          0.126   0.719                 <br />ipip44          0.807                         <br />ipip45 -0.178   0.329           0.340   0.148 <br />ipip46 -0.733                                 <br />ipip47  0.189  -0.296          -0.156   0.490 <br />ipip48                  0.514           0.102 <br />ipip49 -0.131   0.711                         <br />ipip50                          0.831         <br /><br />               Factor1 Factor2 Factor3 Factor4 Factor5<br />SS loadings      6.182   5.548   4.188   4.140   3.473<br />Proportion Var   0.124   0.111   0.084   0.083   0.069<br />Cumulative Var   0.124   0.235   0.318   0.401   0.471<br /><br />Test of the hypothesis that 5 factors are sufficient.<br />The chi square statistic is 1389.91 on 985 degrees of freedom.<br />The p-value is 2.3e-16 <br />> <br />> # Loadings prior to rotation.<br />> fitNoRotation <- factanal(personality[items], <br />+     factors = 5, rotation = "none");<br />> print(fitNoRotation$loadings, cutoff = .30, sort = TRUE);<br /><br />Loadings:<br />       Factor1 Factor2 Factor3 Factor4 Factor5<br />ipip1  -0.679           0.403                 <br />ipip4   0.517           0.510                 <br />ipip6   0.634          -0.419                 <br />ipip11 -0.641           0.342                 <br />ipip14  0.538           0.380                 <br />ipip16  0.762          -0.352                 <br />ipip21 -0.646           0.476                 <br />ipip26  0.662                                 <br />ipip29  0.605           0.505                 <br />ipip31 -0.661           0.472                 <br />ipip36  0.538          -0.314                 <br />ipip41 -0.546           0.437                 <br />ipip46  0.557          -0.393                 <br />ipip49  0.619   0.304   0.318                 <br />ipip15          0.646                         <br />ipip20         -0.523   0.348                 <br />ipip25 -0.396   0.553  -0.416                 <br />ipip30         -0.649                         <br />ipip42          0.553                   0.440 <br />ipip50 -0.347   0.681  -0.318                 <br />ipip3                           0.564         <br />ipip8                          -0.632         <br />ipip18                         -0.583         <br />ipip23                          0.616         <br />ipip28                         -0.623         <br />ipip33                          0.619         <br />ipip43                          0.676         <br />ipip48                          0.509         <br />ipip17          0.386                   0.546 <br />ipip2                                         <br />ipip5                                         <br />ipip7  -0.448   0.362                   0.415 <br />ipip9  -0.404                                 <br />ipip10         -0.370   0.427           0.308 <br />ipip12                  0.323                 <br />ipip13                          0.445         <br />ipip19 -0.446          -0.347                 <br />ipip22         -0.414                  -0.352 <br />ipip24  0.467           0.339                 <br />ipip27          0.385                   0.401 <br />ipip32  0.344  -0.388                  -0.331 <br />ipip34  0.425   0.421   0.500                 <br />ipip35 -0.425   0.306                         <br />ipip37 -0.307                                 <br />ipip38                         -0.444         <br />ipip39  0.376   0.391   0.469                 <br />ipip40                                        <br />ipip44  0.498   0.362   0.477                 <br />ipip45          0.495                         <br />ipip47 -0.500                           0.408 <br /><br />               Factor1 Factor2 Factor3 Factor4 Factor5<br />SS loadings      8.281   4.755   4.553   3.899   2.162<br />Proportion Var   0.166   0.095   0.091   0.078   0.043<br />Cumulative Var   0.166   0.261   0.352   0.430   0.473<br />> <br />> # Loadings after rotation.<br />> fitAfterRotation <- factanal(personality[items], <br />+     factors = 5, rotation = "promax");<br />> print(fitAfterRotation$loadings, cutoff = .30, sort = TRUE);<br /><br />Loadings:<br />       Factor1 Factor2 Factor3 Factor4 Factor5<br />ipip1   0.811                                 <br />ipip6  -0.730                                 <br />ipip11  0.655                                 <br />ipip16 -0.831                                 <br />ipip21  0.736                                 <br />ipip26 -0.630                                 <br />ipip31  0.831                                 <br />ipip36 -0.681                                 <br />ipip41  0.772                                 <br />ipip46 -0.733                                 <br />ipip4           0.770                         <br />ipip9          -0.601                         <br />ipip14          0.636                         <br />ipip19         -0.560                         <br />ipip29          0.808                         <br />ipip34          0.795                         <br />ipip39          0.761                         <br />ipip44          0.807                         <br />ipip49          0.711                         <br />ipip3                   0.562                 <br />ipip8                  -0.672                 <br />ipip18                 -0.648                 <br />ipip23                  0.674                 <br />ipip28                 -0.680                 <br />ipip33                  0.644                 <br />ipip43                  0.719                 <br />ipip48                  0.514                 <br />ipip10                         -0.675         <br />ipip15                          0.646         <br />ipip20                         -0.726         <br />ipip25                          0.765         <br />ipip30                         -0.705         <br />ipip50                          0.831         <br />ipip7                                   0.636 <br />ipip17                                  0.725 <br />ipip22                                 -0.566 <br />ipip27                                  0.602 <br />ipip32                                 -0.560 <br />ipip42                                  0.722 <br />ipip2                                         <br />ipip5                           0.344         <br />ipip12  0.411                                 <br />ipip13                  0.464                 <br />ipip24          0.498                         <br />ipip35                          0.341         <br />ipip37                                  0.409 <br />ipip38                 -0.486                 <br />ipip40                                        <br />ipip45          0.329           0.340         <br />ipip47                                  0.490 <br /><br />               Factor1 Factor2 Factor3 Factor4 Factor5<br />SS loadings      6.182   5.548   4.188   4.140   3.473<br />Proportion Var   0.124   0.111   0.084   0.083   0.069<br />Cumulative Var   0.124   0.235   0.318   0.401   0.471<br />> <br />> # Correlations between factors <br />> # This assumes use of a correlated rotation method such as promax<br />> factorCorrelationsRegression <- cor(factanal(<br />+         personality[items],  factors = 5, <br />+         rotation = "promax", scores = "regression")$scores);<br />> round(factorCorrelationsRegression,2);<br />        Factor1 Factor2 Factor3 Factor4 Factor5<br />Factor1    1.00    0.26    0.04   -0.01   -0.22<br />Factor2    0.26    1.00    0.13    0.04   -0.02<br />Factor3    0.04    0.13    1.00   -0.10   -0.11<br />Factor4   -0.01    0.04   -0.10    1.00   -0.24<br />Factor5   -0.22   -0.02   -0.11   -0.24    1.00<br />

The Scree Plot:

To leave a comment for the author, please follow the link and comment on their blog: Jeromy Anglim's Blog: Psychology and Statistics.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)