factor_analysis reduces the structure of the data by relating the correlation between variables to a set of factors, using the eigen-decomposition of the correlation matrix.

factor_analysis(data, hc_points)

Arguments

data

numeric data

hc_points

vector of eigenvalues [designed to use output from horns_curve]

Value

A list containing:

  1. fa_loadings: numerical matrix with the original factor loadings

  2. fa_scores: numerical matrix with the row scores for each factor

  3. fa_loadings_rotated: numerical matrix with the varimax rotated factor loadings

  4. fa_scores_rotated: numerical matrix with the row scores for each varimax rotated factor

  5. num_factors: numeric vector identifying the number of factors

References

H. F. Kaiser, "The Application of Electronic Computers to Factor Analysis," Educational and Psychological Measurement, 1960.

See also

horns_curve for computing the average eigenvalues used for hc_points argument

Examples

# Perform Factor Analysis with matrix \code{x} x <- matrix(rnorm(200*3), ncol = 10) x %>% horns_curve() %>% factor_analysis(x, hc_points = .)
#> $fa_loadings #> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] 0.4395799 -0.2553486 0.518958714 0.32316204 0.01898560 -0.39719470 #> [2,] -0.6236415 0.3177916 0.388821230 -0.31526755 0.05583719 -0.11671268 #> [3,] -0.7024266 0.1605549 0.242834550 0.03001616 -0.05486700 0.06302161 #> [4,] 0.2138885 -0.4661641 -0.046687236 -0.48046980 0.33567289 -0.33837645 #> [5,] 0.1812043 -0.4597872 0.008662468 -0.27245376 -0.54990557 0.52300060 #> [6,] -0.2155768 -0.4207598 0.598234372 0.25733909 0.09421736 0.22693500 #> [7,] -0.3688848 -0.3335536 -0.089917652 -0.35544626 -0.51922633 -0.46730335 #> [8,] 0.3339126 0.6776472 -0.058302038 -0.12006991 -0.19031721 -0.07059637 #> [9,] -0.4150897 -0.3282095 -0.528889879 0.07302936 0.44832186 0.10451119 #> [10,] 0.2589334 0.1157613 0.344019346 -0.65918242 0.36381875 0.25944970 #> #> $fa_scores #> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] -1.035018355 2.09583293 0.61968327 -1.142198070 0.64508454 0.89021872 #> [2,] 0.006970604 -0.19029918 -0.92649982 -0.108911023 -1.33414297 0.31209921 #> [3,] -1.612548921 0.93343573 0.11436689 -1.415645598 -0.69521992 2.25870549 #> [4,] -0.657624784 -2.00905035 -0.25717815 -0.606986281 -0.63217335 -0.51208408 #> [5,] -0.325638127 -1.57844742 -0.72151411 1.160773178 1.99652472 -0.67082598 #> [6,] 1.246286099 -0.83208537 -0.19416866 -0.652522774 -1.31833075 -1.23024058 #> [7,] -0.928522692 0.59931469 -0.24652956 0.302494975 1.08866789 1.65569480 #> [8,] -0.016971399 -1.75244848 0.58935198 -0.510717378 2.24602190 0.41931005 #> [9,] -0.482346042 -1.23696428 -0.08177693 -0.947372975 0.79190759 0.08351246 #> [10,] 1.672008144 0.84119896 -0.74422454 -0.200569620 -1.17749717 -0.81352896 #> [11,] 1.151962214 0.01975962 -1.56308148 0.196595430 0.26281410 -1.03003432 #> [12,] -0.153521450 0.60616452 -0.15835384 0.915808149 0.09751098 -0.57545996 #> [13,] 0.614096494 1.34765992 2.14703401 -0.008630999 1.32323588 -0.38081767 #> [14,] 1.251945300 2.34458709 -0.95811940 -0.664525306 -0.08398447 0.17218411 #> [15,] 0.659635888 -0.83925688 0.81372636 -1.200014229 0.12547609 0.05340308 #> [16,] -1.108154807 0.38096938 -0.69850724 -0.378546203 -0.44515156 -0.67752460 #> [17,] 0.146635097 -0.53258247 0.78523579 -0.470352827 -0.29044544 0.08871718 #> [18,] 0.346923174 -0.15768643 -0.55619688 0.011505688 0.92904456 -0.51160456 #> [19,] 0.490195196 0.67205600 0.44484492 -1.409300970 1.00877994 -0.72981966 #> [20,] -0.880194109 -1.76048076 -1.17054890 -0.513704283 -0.45508805 0.42946808 #> [21,] -0.507451629 -0.06149283 1.48979700 -0.546203204 -0.03227067 -0.11977161 #> [22,] 0.167575323 0.53622392 0.04343201 -0.274227773 1.54295368 -1.41975777 #> [23,] -1.941458376 -0.31551056 0.15711055 0.963595705 -0.14415943 0.54768565 #> [24,] -0.120505783 0.31756025 0.88609570 -0.609456509 0.68134734 0.06034550 #> [25,] -0.272028048 0.49098063 1.43784263 3.437023706 -1.80729770 -1.00922664 #> [26,] -1.047939450 1.39204766 -0.44208153 0.418693691 0.61316231 -1.87164771 #> [27,] 0.937737354 -1.49013479 -1.70813256 1.050384653 -0.99330383 2.03050351 #> [28,] -0.995628741 -0.56451762 0.06940717 1.010158622 0.18638182 -0.52419861 #> [29,] 0.509385790 1.43548937 -0.65839172 0.259530672 0.31275918 1.32325009 #> [30,] -0.778274374 -0.64899992 -0.90580519 -1.068222250 0.73481442 -0.04707634 #> [31,] 0.480307550 1.35833320 1.26593296 1.066387920 -1.17516491 -0.10996956 #> [32,] -1.250020520 0.93061642 -2.20402057 0.532803936 1.05840000 -2.38916728 #> [33,] -0.370751247 -1.09866325 0.36531586 -0.346024703 -0.59211209 -1.57066737 #> [34,] 0.609306497 -0.25145616 0.50832234 1.497340054 -0.11989070 -0.04245759 #> [35,] -0.211093438 0.26099362 0.75351768 -0.740372134 0.36583503 0.01168761 #> [36,] -1.277188727 -1.42163527 1.53170393 -1.375161001 -1.67207603 0.18691684 #> [37,] 0.647181465 0.19395424 -1.23590818 -1.920380415 0.65918914 2.80890810 #> [38,] -0.283252356 -0.12051457 -0.84101314 -0.750006453 -1.03221253 -0.93957963 #> [39,] -0.197903851 1.64216491 0.97885193 -0.193247604 -1.40558836 0.72468940 #> [40,] -0.093236121 -0.60944638 0.18588997 0.711871738 0.98416780 -0.46532703 #> [41,] 1.218517005 -0.04768547 -0.65585919 -0.528183588 -2.06478115 -0.79870722 #> [42,] -0.229433123 0.10603369 0.67709459 1.039952597 0.87599024 0.78123944 #> [43,] 0.831678084 0.46854396 -1.48686744 1.662153992 -0.72976202 0.06994889 #> [44,] 0.054328105 -0.34892116 -1.24821726 -0.596022253 -0.35184132 -0.39222167 #> [45,] 1.890399737 -0.13618933 -1.30899366 0.956315506 0.75482475 1.14637019 #> [46,] 2.134317568 -1.16871192 2.10606880 0.008271601 0.84292212 0.45932216 #> [47,] 0.726924488 -0.20304448 -0.36430024 -0.416894799 0.68202496 -0.79733691 #> [48,] 0.828886601 0.43610772 1.28395869 -1.219592053 -2.16666424 -1.12597748 #> [49,] 1.111938204 0.50803490 0.26093580 -0.602259691 -0.81155724 0.43782182 #> [50,] -0.517534238 1.92750523 0.29569132 0.720899143 0.02370163 1.65284401 #> [51,] 0.909828885 0.15314301 0.63166518 -0.790082375 0.47784283 -0.28516412 #> [52,] 0.729514936 -0.07378635 -1.12887597 1.277874424 0.36211575 0.80915488 #> [53,] -0.460898346 0.27758053 0.67839166 0.224246579 0.95733173 -0.25571459 #> [54,] -0.843686211 -0.91974903 0.66670917 1.654981179 -0.03365986 1.52421061 #> [55,] -1.129753695 -1.55325210 0.46603912 -0.079048584 -1.10830251 0.35190201 #> [56,] -1.753971492 0.38242530 1.31465096 0.390669625 0.82966905 -0.98829250 #> [57,] -0.949260581 0.79785444 -1.51260242 0.053599622 0.38515824 -0.14781425 #> [58,] 2.542890698 -1.15604894 1.41047782 1.427018985 0.65032039 0.59384516 #> [59,] 0.384225260 -0.04668787 -0.47214969 -1.648200573 -0.16699165 -0.40690593 #> [60,] -1.869790724 -0.33082224 -0.52922781 0.982633129 -1.65631068 0.95496313 #> #> $fa_loadings_rotated #> [,1] [,2] [,3] [,4] [,5] #> [1,] 0.22975749 -0.04442467 0.847935407 -0.008351855 -0.018408527 #> [2,] -0.81698772 0.06688169 -0.049769375 -0.189546016 -0.142622318 #> [3,] -0.72533712 -0.13856591 -0.097142817 0.172749883 -0.023849361 #> [4,] 0.32212520 -0.27475162 0.066704926 -0.594088794 -0.404883891 #> [5,] 0.17065148 -0.07173455 -0.039670658 -0.058882924 -0.130685898 #> [6,] -0.31731632 -0.53104326 0.473498133 0.001753128 0.209816371 #> [7,] -0.17714349 -0.05031538 -0.024486289 0.100411662 -0.895736194 #> [8,] 0.04665207 0.77343936 -0.068341540 -0.018858965 0.119382795 #> [9,] 0.08971386 -0.64078612 -0.544518574 0.062704394 -0.003263213 #> [10,] -0.10223904 0.14580211 -0.004420677 -0.861931036 0.205787936 #> [,6] #> [1,] -0.12705989 #> [2,] -0.16293430 #> [3,] -0.02949838 #> [4,] -0.15062520 #> [5,] 0.91546905 #> [6,] 0.23890027 #> [7,] 0.15097279 #> [8,] -0.10030157 #> [9,] -0.24061475 #> [10,] 0.12645862 #> #> $fa_scores_rotated #> [,1] [,2] [,3] [,4] [,5] [,6] #> [1,] -1.98173263 1.08722987 -1.06647009 -1.01409603 0.996391496 -0.305201026 #> [2,] 0.42168944 0.38387618 -0.67722520 0.78676200 -0.647729424 0.980563380 #> [3,] -2.02169613 0.38174884 -1.82608169 -0.45138808 0.576750142 1.723332843 #> [4,] 0.18841220 -1.36702259 0.05237204 -0.03678950 -1.758709364 0.750862841 #> [5,] 0.97110663 -2.35499450 0.05470484 0.14608326 0.169873630 -1.536032124 #> [6,] 1.25402233 0.69057202 0.81631250 -0.12140263 -1.711099102 0.549676126 #> [7,] -0.80048040 -0.64064208 -1.23078053 -0.04311183 1.652944336 -0.006332349 #> [8,] 0.28932680 -2.25888899 0.28542863 -1.80232540 0.520928259 -0.335357983 #> [9,] -0.01682349 -1.29919499 -0.37880538 -1.07154301 -0.554741208 0.115788342 #> [10,] 1.36731032 1.94790092 0.16390638 0.29883925 -0.603238315 0.041618196 #> [11,] 1.81854453 0.43847486 -0.42743362 0.22314635 -0.495071228 -0.981004117 #> [12,] -0.05589813 0.25687216 0.17169201 0.82969102 0.203651992 -0.875785322 #> [13,] -0.95861671 0.81309331 1.57977099 -1.28500456 1.301276560 -1.130843083 #> [14,] 0.59885796 2.46171741 -1.07247652 -0.38092905 0.719044909 -0.479292432 #> [15,] 0.19890461 -0.19764175 0.62899093 -1.45766290 -0.426971214 0.692034710 #> [16,] -0.64622011 0.21510621 -0.85092595 0.46998158 -1.028918874 -0.440512242 #> [17,] -0.21175148 -0.14265853 0.62565570 -0.52445319 -0.284253942 0.650165839 #> [18,] 0.70869536 -0.31495180 -0.19530881 -0.35993212 -0.004685748 -0.900227020 #> [19,] -0.13947900 0.69301006 0.06851353 -1.75010170 -0.219605709 -0.900414608 #> [20,] 0.36062116 -1.49014767 -1.09989542 0.22056921 -1.145185100 0.989546171 #> [21,] -1.21240248 -0.08731164 0.86370269 -0.68845873 -0.195511797 0.242451004 #> [22,] 0.10624047 0.08880000 0.21505999 -0.89682092 -0.147224019 -1.974268728 #> [23,] -1.40127416 -1.21938901 -0.35367290 1.22698028 0.200764530 0.146284321 #> [24,] -0.69904530 0.04413151 0.29150496 -1.00281686 0.316887515 -0.241243294 #> [25,] -0.68163252 0.46349131 2.54442544 3.33462185 0.374228032 -0.259134402 #> [26,] -0.78861304 0.58237010 -0.29607926 0.63534774 -0.604014523 -2.338486428 #> [27,] 2.01370458 -0.89378035 -0.93802472 1.30390762 0.731850176 2.064208135 #> [28,] -0.43301896 -1.04798598 0.30952168 0.92875906 -0.236631171 -0.586979963 #> [29,] 0.22533719 0.94883706 -1.04681955 0.12236264 1.612409086 0.089515765 #> [30,] -0.01849538 -0.89689172 -1.23537170 -0.78365237 -0.719568500 -0.260522993 #> [31,] -0.64397355 1.54385856 1.35834700 1.03458562 0.670614657 0.212698339 #> [32,] 0.20151537 -0.01441095 -1.46778669 1.04569672 -1.215752692 -3.103508602 #> [33,] -0.08557299 -0.46596901 0.88218386 0.03035471 -1.836288562 -0.199307844 #> [34,] 0.48968086 -0.21139236 1.16380169 0.91416064 0.688711407 -0.046458029 #> [35,] -0.71669613 0.12934992 0.17750202 -0.89229623 0.029707740 -0.060191068 #> [36,] -1.63397539 -0.63118388 0.72402956 -0.46482306 -1.693382964 2.011000982 #> [37,] 0.64035340 0.13844079 -2.41956608 -1.80416650 1.308857385 1.656696814 #> [38,] 0.15906605 0.50352349 -0.53256144 0.27154138 -1.634378456 0.073849660 #> [39,] -1.36352117 1.74519403 0.17559314 0.38761702 0.485948754 0.953992841 #> [40,] 0.22526141 -1.00861438 0.52514355 0.03414439 0.222903155 -0.843727880 #> [41,] 1.15415206 1.51551185 0.24959974 0.50400675 -1.511699747 0.931149344 #> [42,] -0.42414305 -0.69074712 0.39270699 0.21788450 1.440272737 -0.220064183 #> [43,] 1.43790716 0.62347466 -0.38406383 1.87865044 0.518531307 -0.142102666 #> [44,] 0.72751159 0.06186166 -0.89255925 0.03586149 -0.991797021 0.030119188 #> [45,] 2.27553720 -0.05241862 -0.49726116 0.17176415 1.620799351 0.139671260 #> [46,] 0.95657997 -0.47463525 2.38573694 -1.65120465 1.095387780 0.721021501 #> [47,] 0.86535960 0.03194418 0.08383368 -0.71166544 -0.380960266 -0.754037298 #> [48,] -0.38453341 1.99217005 1.41896678 -0.36742045 -1.640305468 1.009842984 #> [49,] 0.39222394 1.24036675 0.22458000 -0.42582560 0.144776352 0.911345303 #> [50,] -1.20324386 0.92073489 -0.70608349 0.64104991 2.014666287 0.242434461 #> [51,] 0.27179566 0.48568301 0.57110947 -1.23223741 0.047056856 -0.166055718 #> [52,] 1.30886115 -0.31290875 -0.51613978 0.89036397 1.166028494 -0.031934001 #> [53,] -0.68531349 -0.36966687 0.36463001 -0.32400242 0.458418082 -0.852916217 #> [54,] -0.59509014 -1.58083645 0.42688285 1.18523315 1.300054671 0.967075279 #> [55,] -0.72405026 -1.21699396 0.27233771 0.50998741 -0.990876799 1.393962417 #> [56,] -1.97782188 -0.66897882 0.70322228 0.07948027 -0.140811346 -1.374295902 #> [57,] -0.16415555 0.08480111 -1.64898724 0.58449291 -0.099302303 -0.945469290 #> [58,] 1.80051171 -0.54715557 2.41029995 -0.36997409 1.673429532 0.562251799 #> [59,] 0.35197262 0.57972905 -0.58883933 -1.15375613 -1.054236539 0.182996627 #> [60,] -1.11179255 -0.63646225 -0.83284992 2.12393356 -0.290213809 1.255550339 #> #> $num_factors #> [1] 6 #>