今回は 因子分析法 です。
因子分析法の目的は 項目情報 の要約です。 距離行列ではなく,項目同士の 相関行列 を使います。 情報要約にあたって,各回答者(=各ケース,各行)に 共通する隠された要素がある というモデルを持っています。
このモデルは,心理学の人間に対するモデルに非常に相性がいい。実際,心理検査・調査のほとんどで因子分析を使います。 性格が五次元だった,という話も因子分析をして五因子構造が得られた,ということです(因子=次元)。
モデルの詳細については,心理教育測定法 で解説するとして,実際のやり方を追っていきたいと思います。
使うデータは,BFIで,psychパッケージに含まれている性格のデータセットです。
library(psych)
data(bfi)
head(bfi)
## A1 A2 A3 A4 A5 C1 C2 C3 C4 C5 E1 E2 E3 E4 E5 N1 N2 N3 N4 N5 O1 O2 O3
## 61617 2 4 3 4 4 2 3 3 4 4 3 3 3 4 4 3 4 2 2 3 3 6 3
## 61618 2 4 5 2 5 5 4 4 3 4 1 1 6 4 3 3 3 3 5 5 4 2 4
## 61620 5 4 5 4 4 4 5 4 2 5 2 4 4 4 5 4 5 4 2 3 4 2 5
## 61621 4 4 6 5 5 4 4 3 5 5 5 3 4 4 4 2 5 2 4 1 3 3 4
## 61622 2 3 3 4 5 4 4 5 3 2 2 2 5 4 5 2 3 4 4 3 3 3 4
## 61623 6 6 5 6 5 6 6 6 1 3 2 1 6 5 6 3 5 2 2 3 4 3 5
## O4 O5 gender education age
## 61617 4 3 1 NA 16
## 61618 3 3 2 NA 18
## 61620 5 2 2 NA 17
## 61621 3 5 2 NA 17
## 61622 3 3 1 NA 17
## 61623 6 1 2 3 21
これは性格検査に関するデータで,5つの性格特性をそれぞれ5つの項目で測るテストを2800人分集めたものです。 性格特性は次の通り。
データは相関行列から始められるのでした。相関行列を確認します。
sub_bfi <- subset(bfi[1:25],complete.cases(bfi[1:25]))
cor(sub_bfi)
## A1 A2 A3 A4 A5 C1 C2
## A1 1.000000 -0.35091 -0.273636 -0.15675 -0.192698 0.01470 0.012918
## A2 -0.350905 1.00000 0.503041 0.35086 0.397400 0.10298 0.129574
## A3 -0.273636 0.50304 1.000000 0.38492 0.515679 0.11421 0.146511
## A4 -0.156754 0.35086 0.384918 1.00000 0.325644 0.09481 0.226454
## A5 -0.192698 0.39740 0.515679 0.32564 1.000000 0.13469 0.116863
## C1 0.014698 0.10298 0.114211 0.09481 0.134692 1.00000 0.438223
## C2 0.012918 0.12957 0.146511 0.22645 0.116863 0.43822 1.000000
## C3 -0.020587 0.18882 0.129391 0.13306 0.130820 0.31727 0.362826
## C4 0.115074 -0.14629 -0.121116 -0.17227 -0.125531 -0.36249 -0.396090
## C5 0.038293 -0.12111 -0.153811 -0.24968 -0.167036 -0.26108 -0.303820
## E1 0.107178 -0.22228 -0.210366 -0.13360 -0.252310 -0.03051 0.017052
## E2 0.087922 -0.24308 -0.291863 -0.20998 -0.338485 -0.10680 -0.075232
## E3 -0.048913 0.25507 0.383131 0.20438 0.411831 0.13477 0.152957
## E4 -0.069781 0.29713 0.387630 0.31894 0.482558 0.15321 0.122901
## E5 -0.020182 0.29419 0.253463 0.16887 0.268616 0.26783 0.257836
## N1 0.168279 -0.09363 -0.083266 -0.10665 -0.204765 -0.07195 -0.019951
## N2 0.139814 -0.05048 -0.092473 -0.15529 -0.198836 -0.03818 -0.005586
## N3 0.092366 -0.04041 -0.039158 -0.07389 -0.138472 -0.02548 0.003189
## N4 0.042140 -0.08674 -0.127107 -0.17123 -0.215346 -0.09804 -0.044341
## N5 0.015181 0.01969 -0.040143 -0.01514 -0.081404 -0.04797 0.051212
## O1 0.005782 0.12563 0.150086 0.05708 0.162596 0.17925 0.161042
## O2 0.066176 0.01396 0.006588 0.03776 -0.006988 -0.12926 -0.057347
## O3 -0.063788 0.16532 0.226333 0.07098 0.238191 0.19656 0.192681
## O4 -0.090512 0.08261 0.032267 -0.04979 0.011354 0.10019 0.047427
## O5 0.099166 -0.08084 -0.041750 0.02731 -0.050449 -0.13047 -0.066590
## C3 C4 C5 E1 E2 E3 E4
## A1 -0.020587 0.11507 0.03829 0.107178 0.08792 -0.04891 -0.06978
## A2 0.188818 -0.14629 -0.12111 -0.222280 -0.24308 0.25507 0.29713
## A3 0.129391 -0.12112 -0.15381 -0.210366 -0.29186 0.38313 0.38763
## A4 0.133065 -0.17227 -0.24968 -0.133600 -0.20998 0.20438 0.31894
## A5 0.130820 -0.12553 -0.16704 -0.252310 -0.33849 0.41183 0.48256
## C1 0.317270 -0.36249 -0.26108 -0.030506 -0.10680 0.13477 0.15321
## C2 0.362826 -0.39609 -0.30382 0.017052 -0.07523 0.15296 0.12290
## C3 1.000000 -0.35782 -0.35095 -0.009045 -0.08924 0.09256 0.09954
## C4 -0.357824 1.00000 0.48755 0.098480 0.20782 -0.08455 -0.11254
## C5 -0.350949 0.48755 1.00000 0.067669 0.26636 -0.16326 -0.20722
## E1 -0.009045 0.09848 0.06767 1.000000 0.46904 -0.32250 -0.41966
## E2 -0.089244 0.20782 0.26636 0.469038 1.00000 -0.38556 -0.52709
## E3 0.092564 -0.08455 -0.16326 -0.322502 -0.38556 1.00000 0.41718
## E4 0.099537 -0.11254 -0.20722 -0.419658 -0.52709 0.41718 1.00000
## E5 0.207488 -0.23501 -0.23483 -0.307265 -0.38341 0.39078 0.32337
## N1 -0.079093 0.21585 0.21641 0.014867 0.17619 -0.04668 -0.14352
## N2 -0.066880 0.15835 0.24630 0.020181 0.20653 -0.05991 -0.15219
## N3 -0.077416 0.20191 0.24160 0.054725 0.19350 -0.01666 -0.12264
## N4 -0.122175 0.27063 0.35466 0.235033 0.35130 -0.14658 -0.30649
## N5 -0.023508 0.19706 0.17901 0.054037 0.25938 -0.07955 -0.10352
## O1 0.091141 -0.09356 -0.08563 -0.104510 -0.15848 0.32815 0.13776
## O2 -0.029604 0.20807 0.12260 0.049378 0.07940 -0.07395 0.04994
## O3 0.058880 -0.08303 -0.07413 -0.217140 -0.23778 0.40638 0.21529
## O4 0.011360 0.05301 0.13548 0.094333 0.17192 0.05275 -0.09938
## O5 -0.002809 0.18954 0.05580 0.088860 0.08144 -0.12303 0.04738
## E5 N1 N2 N3 N4 N5 O1
## A1 -0.0201824 0.16828 0.139814 0.092366 0.04214 0.01518 0.005782
## A2 0.2941913 -0.09363 -0.050476 -0.040407 -0.08674 0.01969 0.125633
## A3 0.2534630 -0.08327 -0.092473 -0.039158 -0.12711 -0.04014 0.150086
## A4 0.1688732 -0.10665 -0.155289 -0.073887 -0.17123 -0.01514 0.057075
## A5 0.2686160 -0.20477 -0.198836 -0.138472 -0.21535 -0.08140 0.162596
## C1 0.2678287 -0.07195 -0.038180 -0.025476 -0.09804 -0.04797 0.179249
## C2 0.2578360 -0.01995 -0.005586 0.003189 -0.04434 0.05121 0.161042
## C3 0.2074876 -0.07909 -0.066880 -0.077416 -0.12218 -0.02351 0.091141
## C4 -0.2350122 0.21585 0.158346 0.201905 0.27063 0.19706 -0.093561
## C5 -0.2348337 0.21641 0.246298 0.241599 0.35466 0.17901 -0.085630
## E1 -0.3072653 0.01487 0.020181 0.054725 0.23503 0.05404 -0.104510
## E2 -0.3834057 0.17619 0.206527 0.193497 0.35130 0.25938 -0.158476
## E3 0.3907755 -0.04668 -0.059906 -0.016664 -0.14658 -0.07955 0.328152
## E4 0.3233694 -0.14352 -0.152192 -0.122642 -0.30649 -0.10352 0.137764
## E5 1.0000000 0.03405 0.038921 -0.065330 -0.20717 -0.14192 0.290956
## N1 0.0340540 1.00000 0.718260 0.567346 0.40987 0.38060 -0.051269
## N2 0.0389209 0.71826 1.000000 0.550060 0.39484 0.35079 -0.043021
## N3 -0.0653299 0.56735 0.550060 1.000000 0.52327 0.43063 -0.039684
## N4 -0.2071716 0.40987 0.394838 0.523270 1.00000 0.40292 -0.048703
## N5 -0.1419184 0.38060 0.350795 0.430630 0.40292 1.00000 -0.129129
## O1 0.2909555 -0.05127 -0.043021 -0.039684 -0.04870 -0.12913 1.000000
## O2 -0.0846278 0.13523 0.117041 0.104223 0.07404 0.18683 -0.230459
## O3 0.3055853 -0.03922 -0.029635 -0.028228 -0.06292 -0.08049 0.392942
## O4 -0.0009925 0.07880 0.130927 0.165739 0.22013 0.11147 0.176874
## O5 -0.1132111 0.10613 0.024446 0.056517 0.03574 0.13829 -0.246470
## O2 O3 O4 O5
## A1 0.066176 -0.06379 -0.0905116 0.099166
## A2 0.013958 0.16532 0.0826091 -0.080838
## A3 0.006588 0.22633 0.0322665 -0.041750
## A4 0.037763 0.07098 -0.0497932 0.027308
## A5 -0.006988 0.23819 0.0113540 -0.050449
## C1 -0.129263 0.19656 0.1001894 -0.130471
## C2 -0.057347 0.19268 0.0474269 -0.066590
## C3 -0.029604 0.05888 0.0113600 -0.002809
## C4 0.208072 -0.08303 0.0530143 0.189543
## C5 0.122596 -0.07413 0.1354819 0.055804
## E1 0.049378 -0.21714 0.0943327 0.088860
## E2 0.079402 -0.23778 0.1719227 0.081439
## E3 -0.073949 0.40638 0.0527494 -0.123032
## E4 0.049936 0.21529 -0.0993813 0.047375
## E5 -0.084628 0.30559 -0.0009925 -0.113211
## N1 0.135227 -0.03922 0.0787959 0.106132
## N2 0.117041 -0.02964 0.1309268 0.024446
## N3 0.104223 -0.02823 0.1657393 0.056517
## N4 0.074038 -0.06292 0.2201276 0.035744
## N5 0.186831 -0.08049 0.1114697 0.138288
## O1 -0.230459 0.39294 0.1768736 -0.246470
## O2 1.000000 -0.28361 -0.0747809 0.327783
## O3 -0.283608 1.00000 0.1838900 -0.310072
## O4 -0.074781 0.18389 1.0000000 -0.182152
## O5 0.327783 -0.31007 -0.1821524 1.000000
この相関係数が高いところ,は強い関係があるわけですから,一つの因子(次元)としてまとめることができそうです。 この相関行列をじっと見ていても仕方ないので,因子分析を始めたいと思います。
しかし研究を始める頃は,用意した25項目が5つにわかれる,ということは事前にはわかりません。まずは因子数を決める必要があります。 因子数を決める方法はいくつかあるのですが,ひとまず平行分析(psychパッケージに含まれている関数)と呼ばれる方法を使ってみましょう。
fa.parallel(sub_bfi,fa="fa")
## Loading required package: parallel
## Loading required package: MASS
## Parallel analysis suggests that the number of factors = 6 and the number of components = 5
平行分析の結果は6因子(か5成分)がよい,ということになりました。そのほかに
という理由が考えられrます。なんであれ,自分で理由を考えて ここでは5因子にすることにします。
因子分析をするのは,fa関数です(psychパッケージに含まれている関数)。
result.fa <- fa(sub_bfi,5,fm="ml",rotate="none")
print(result.fa)
## Factor Analysis using method = ml
## Call: fa(r = sub_bfi, nfactors = 5, rotate = "none", fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
## ML1 ML2 ML3 ML4 ML5 h2 u2 com
## A1 0.23 -0.04 0.12 0.00 -0.32 0.17 0.83 2.1
## A2 -0.40 0.35 -0.14 0.11 0.33 0.42 0.58 3.4
## A3 -0.46 0.40 -0.21 0.10 0.32 0.53 0.47 3.4
## A4 -0.39 0.21 -0.07 0.26 0.20 0.31 0.69 3.1
## A5 -0.55 0.30 -0.24 0.05 0.21 0.49 0.51 2.3
## C1 -0.29 0.20 0.46 0.03 0.04 0.34 0.66 2.1
## C2 -0.26 0.25 0.51 0.16 0.11 0.43 0.57 2.4
## C3 -0.28 0.13 0.40 0.24 0.08 0.32 0.68 2.9
## C4 0.44 -0.03 -0.51 -0.17 0.04 0.49 0.51 2.2
## C5 0.49 -0.01 -0.36 -0.26 0.11 0.44 0.56 2.6
## E1 0.36 -0.31 0.24 0.05 0.29 0.37 0.63 3.8
## E2 0.58 -0.24 0.19 -0.01 0.34 0.55 0.45 2.2
## E3 -0.45 0.44 -0.12 -0.19 -0.04 0.44 0.56 2.5
## E4 -0.55 0.33 -0.28 0.13 -0.14 0.53 0.47 2.5
## E5 -0.41 0.43 0.12 -0.05 -0.20 0.41 0.59 2.6
## N1 0.61 0.57 0.03 0.09 -0.17 0.73 0.27 2.2
## N2 0.59 0.54 0.08 0.04 -0.12 0.66 0.34 2.1
## N3 0.53 0.48 0.01 0.02 0.09 0.52 0.48 2.0
## N4 0.59 0.22 0.02 -0.11 0.29 0.49 0.51 1.9
## N5 0.42 0.29 -0.03 0.16 0.22 0.34 0.66 2.7
## O1 -0.27 0.25 0.16 -0.41 0.01 0.33 0.67 2.8
## O2 0.19 0.03 -0.26 0.39 0.03 0.26 0.74 2.3
## O3 -0.33 0.35 0.10 -0.49 0.01 0.48 0.52 2.7
## O4 0.11 0.17 0.13 -0.31 0.31 0.25 0.75 3.2
## O5 0.17 -0.07 -0.22 0.43 -0.04 0.27 0.73 1.9
##
## ML1 ML2 ML3 ML4 ML5
## SS loadings 4.45 2.38 1.55 1.22 0.98
## Proportion Var 0.18 0.10 0.06 0.05 0.04
## Cumulative Var 0.18 0.27 0.34 0.38 0.42
## Proportion Explained 0.42 0.22 0.15 0.12 0.09
## Cumulative Proportion 0.42 0.65 0.79 0.91 1.00
##
## Mean item complexity = 2.6
## Test of the hypothesis that 5 factors are sufficient.
##
## The degrees of freedom for the null model are 300 and the objective function was 7.48 with Chi Square of 18146
## The degrees of freedom for the model are 185 and the objective function was 0.62
##
## The root mean square of the residuals (RMSR) is 0.03
## The df corrected root mean square of the residuals is 0.04
##
## The harmonic number of observations is 2436 with the empirical chi square 1197 with prob < 1.4e-147
## The total number of observations was 2436 with MLE Chi Square = 1491 with prob < 1.2e-202
##
## Tucker Lewis Index of factoring reliability = 0.881
## RMSEA index = 0.054 and the 90 % confidence intervals are 0.051 0.056
## BIC = 47.94
## Fit based upon off diagonal values = 0.98
## Measures of factor score adequacy
## ML1 ML2 ML3 ML4 ML5
## Correlation of scores with factors 0.95 0.92 0.85 0.81 0.80
## Multiple R square of scores with factors 0.90 0.84 0.73 0.66 0.64
## Minimum correlation of possible factor scores 0.81 0.68 0.46 0.33 0.28
ここで示されるのは 因子負荷量 と呼ばれる,因子と項目の相関係数です。これを見て,どの項目がどの因子と関係が深いのか,を考えます。
この表は見にくいので,大きさの順に並べ直し,小さな数字は表示しないようにしましょう。
print(result.fa,sort=T,cut=0.3)
## Factor Analysis using method = ml
## Call: fa(r = sub_bfi, nfactors = 5, rotate = "none", fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
## item ML1 ML2 ML3 ML4 ML5 h2 u2 com
## N1 16 0.61 0.57 0.73 0.27 2.2
## N4 19 0.59 0.49 0.51 1.9
## N2 17 0.59 0.54 0.66 0.34 2.1
## E2 12 0.58 0.34 0.55 0.45 2.2
## E4 14 -0.55 0.33 0.53 0.47 2.5
## A5 5 -0.55 0.49 0.51 2.3
## N3 18 0.53 0.48 0.52 0.48 2.0
## C5 10 0.49 -0.36 0.44 0.56 2.6
## A3 3 -0.46 0.40 0.32 0.53 0.47 3.4
## E3 13 -0.45 0.44 0.44 0.56 2.5
## N5 20 0.42 0.34 0.66 2.7
## A2 2 -0.40 0.35 0.33 0.42 0.58 3.4
## A4 4 -0.39 0.31 0.69 3.1
## E1 11 0.36 -0.31 0.37 0.63 3.8
## E5 15 -0.41 0.43 0.41 0.59 2.6
## C4 9 0.44 -0.51 0.49 0.51 2.2
## C2 7 0.51 0.43 0.57 2.4
## C1 6 0.46 0.34 0.66 2.1
## C3 8 0.40 0.32 0.68 2.9
## O3 23 -0.33 0.35 -0.49 0.48 0.52 2.7
## O5 25 0.43 0.27 0.73 1.9
## O1 21 -0.41 0.33 0.67 2.8
## O2 22 0.39 0.26 0.74 2.3
## A1 1 -0.32 0.17 0.83 2.1
## O4 24 -0.31 0.31 0.25 0.75 3.2
##
## ML1 ML2 ML3 ML4 ML5
## SS loadings 4.45 2.38 1.55 1.22 0.98
## Proportion Var 0.18 0.10 0.06 0.05 0.04
## Cumulative Var 0.18 0.27 0.34 0.38 0.42
## Proportion Explained 0.42 0.22 0.15 0.12 0.09
## Cumulative Proportion 0.42 0.65 0.79 0.91 1.00
##
## Mean item complexity = 2.6
## Test of the hypothesis that 5 factors are sufficient.
##
## The degrees of freedom for the null model are 300 and the objective function was 7.48 with Chi Square of 18146
## The degrees of freedom for the model are 185 and the objective function was 0.62
##
## The root mean square of the residuals (RMSR) is 0.03
## The df corrected root mean square of the residuals is 0.04
##
## The harmonic number of observations is 2436 with the empirical chi square 1197 with prob < 1.4e-147
## The total number of observations was 2436 with MLE Chi Square = 1491 with prob < 1.2e-202
##
## Tucker Lewis Index of factoring reliability = 0.881
## RMSEA index = 0.054 and the 90 % confidence intervals are 0.051 0.056
## BIC = 47.94
## Fit based upon off diagonal values = 0.98
## Measures of factor score adequacy
## ML1 ML2 ML3 ML4 ML5
## Correlation of scores with factors 0.95 0.92 0.85 0.81 0.80
## Multiple R square of scores with factors 0.90 0.84 0.73 0.66 0.64
## Minimum correlation of possible factor scores 0.81 0.68 0.46 0.33 0.28
これで随分とわかりやすくなりました。が,軸の回転,とよばれる,負荷量の強調を行うともっとわかりやすくなります。
result.fa2 <- fa(sub_bfi,5,fm="ml",rotate="promax")
print(result.fa2,sort=T,cut=0.3)
## Factor Analysis using method = ml
## Call: fa(r = sub_bfi, nfactors = 5, rotate = "promax", fm = "ml")
## Standardized loadings (pattern matrix) based upon correlation matrix
## item ML2 ML1 ML3 ML5 ML4 h2 u2 com
## N1 16 0.91 0.73 0.27 1.1
## N2 17 0.86 0.66 0.34 1.1
## N3 18 0.68 0.52 0.48 1.0
## N5 20 0.44 0.34 0.66 2.1
## N4 19 0.40 -0.39 0.49 0.51 2.4
## E2 12 -0.71 0.55 0.45 1.0
## E1 11 -0.64 0.37 0.63 1.2
## E4 14 0.62 0.31 0.53 0.47 1.5
## E5 15 0.46 0.41 0.59 2.4
## E3 13 0.46 0.31 0.44 0.56 2.5
## C4 9 -0.68 0.49 0.51 1.1
## C2 7 0.67 0.43 0.57 1.2
## C3 8 0.59 0.32 0.68 1.1
## C5 10 -0.58 0.44 0.56 1.3
## C1 6 0.55 0.34 0.66 1.2
## A3 3 0.66 0.53 0.47 1.1
## A2 2 0.60 0.42 0.58 1.1
## A5 5 0.55 0.49 0.51 1.6
## A4 4 0.45 0.31 0.69 1.8
## A1 1 -0.41 0.17 0.83 1.8
## O3 23 0.63 0.48 0.52 1.3
## O1 21 0.53 0.33 0.67 1.1
## O5 25 -0.52 0.27 0.73 1.2
## O2 22 -0.46 0.26 0.74 1.7
## O4 24 -0.31 0.37 0.25 0.75 2.4
##
## ML2 ML1 ML3 ML5 ML4
## SS loadings 2.56 2.40 2.05 1.96 1.61
## Proportion Var 0.10 0.10 0.08 0.08 0.06
## Cumulative Var 0.10 0.20 0.28 0.36 0.42
## Proportion Explained 0.24 0.23 0.19 0.19 0.15
## Cumulative Proportion 0.24 0.47 0.66 0.85 1.00
##
## With factor correlations of
## ML2 ML1 ML3 ML5 ML4
## ML2 1.00 -0.37 -0.25 0.06 0.02
## ML1 -0.37 1.00 0.37 0.25 0.14
## ML3 -0.25 0.37 1.00 0.22 0.24
## ML5 0.06 0.25 0.22 1.00 0.21
## ML4 0.02 0.14 0.24 0.21 1.00
##
## Mean item complexity = 1.5
## Test of the hypothesis that 5 factors are sufficient.
##
## The degrees of freedom for the null model are 300 and the objective function was 7.48 with Chi Square of 18146
## The degrees of freedom for the model are 185 and the objective function was 0.62
##
## The root mean square of the residuals (RMSR) is 0.03
## The df corrected root mean square of the residuals is 0.04
##
## The harmonic number of observations is 2436 with the empirical chi square 1197 with prob < 1.4e-147
## The total number of observations was 2436 with MLE Chi Square = 1491 with prob < 1.2e-202
##
## Tucker Lewis Index of factoring reliability = 0.881
## RMSEA index = 0.054 and the 90 % confidence intervals are 0.051 0.056
## BIC = 47.94
## Fit based upon off diagonal values = 0.98
## Measures of factor score adequacy
## ML2 ML1 ML3 ML5 ML4
## Correlation of scores with factors 0.93 0.90 0.89 0.87 0.85
## Multiple R square of scores with factors 0.87 0.81 0.79 0.76 0.72
## Minimum correlation of possible factor scores 0.75 0.63 0.58 0.53 0.43
本来は背後に潜む変数がいくつあるのか,どんなものかもわからなかったわけですから,要約が終わった後に(後知恵で),因子を解釈します。これを特に,「因子を命名する」といいます。