Library: | stats |
See also: | factorlikehood varimax varimaxval factorrot |
Quantlet: | factoranalysis | |
Description: | performs factor analysis on the data using three different methods and extracts k factors |
Usage: | {loadings,explained,communalities,specifics,pvalue}=factoranalysis(data,k{,method{,maxiter}}) | |
Input: | ||
data | n x p data matrix | |
k | scalar, number of factors to be extracted. Beware that it can be changed to a lower number so that all loadings can be computed. | |
method | optional string defining the method which should be used, "PFM" = Principal Factors Method; "PCM" = Principal Components Method (default); "MLM" = Maximum Likelihood Method | |
maxiter | optional integer, maximal number of iterations for PFM or MLM, default is 10. For MLM, 10 is recommended and sufficient since the method is computationally time consuming, for PFM, it can be much more but should not change the results. | |
Output: | ||
loadings | p x k matrix of estimated factor loadings | |
explained | 1 x k vector with proportion of explained variance of the k-th factor | |
communalities | p x 1 vector of estimated communalities | |
specifics | p x 1 vector; estimated specific variances | |
pvalue | optional, result of a likelihood test for H0: SIGMA=loadings*loadings'+diag(specifics), i.e., the model holds. It only works if k is sufficiently small compared to p. Otherwise you get an error warning. |
We recommend to perform varimax rotation on the result in order to improve the interpretation of the FA model.
library("nummath") library("xplore") library("stats") y=read("decathlo") y=y[,1:10] b=factoranalysis(y,3,"PFM",10) b varimax(b.loadings)
Contents of b.loadings [ 1,] 0.8513 -0.37924 -0.10322 [ 2,] 0.67668 -0.2378 0.5339 [ 3,] 0.61571 0.03942 -0.2804 [ 4,] 0.57424 0.49455 0.037712 [ 5,] 0.80336 -0.37154 0.14977 [ 6,] 0.83119 -0.040257 -0.21215 [ 7,] 0.56891 0.4344 -0.2316 [ 8,] 0.55473 0.17172 0.22624 [ 9,] 0.42994 0.30881 -0.21547 [10,] 0.064053 0.50396 0.50722 Contents of b.explained [1,] 0.4048 0.11537 0.085172 Contents of b.communalities [ 1,] 0.87919 [ 2,] 0.79949 [ 3,] 0.45928 [ 4,] 0.57576 [ 5,] 0.80586 [ 6,] 0.7375 [ 7,] 0.566 [ 8,] 0.38839 [ 9,] 0.32664 [10,] 0.51535 Contents of b.specifics [ 1,] 0.12081 [ 2,] 0.20051 [ 3,] 0.54072 [ 4,] 0.42424 [ 5,] 0.19414 [ 6,] 0.2625 [ 7,] 0.434 [ 8,] 0.61161 [ 9,] 0.67336 [10,] 0.48465 Contents of rotated [ 1,] 0.90806 -0.095924 0.21312 [ 2,] 0.48177 -0.19221 0.72831 [ 3,] 0.61769 0.2782 0.018456 [ 4,] 0.30753 0.59669 0.35375 [ 5,] 0.77456 -0.1732 0.41944 [ 6,] 0.80842 0.2422 0.15904 [ 7,] 0.41936 0.61619 0.10218 [ 8,] 0.33903 0.24045 0.46436 [ 9,] 0.33813 0.45918 0.038189 [10,] -0.30297 0.33771 0.55634