EXAMPLE 4.2: EXPLORATORY FACTOR ANALYSIS WITH CATEGORICAL FACTOR INDICATORS
バイナリ(2値)データの因子分析のアプローチは下記の論文のものである。
- Muthén, B. (1978). Contributions to factor analysis of dichotomous variables. Psychometrika, 43(4), 551–560. https://doi.org/10.1007/BF02293813
SUMMARY OF MODEL FIT INFORMATION Number of Degrees of Model Parameters Chi-Square Freedom P-Value 1-factor 12 730.699 54 0.0000 2-factor 23 485.520 43 0.0000 3-factor 33 268.580 33 0.0000 4-factor 42 22.796 24 0.5319 Degrees of Models Compared Chi-Square Freedom P-Value 1-factor against 2-factor 228.003 11 0.0000 2-factor against 3-factor 183.837 10 0.0000 3-factor against 4-factor 158.815 9 0.0000
FACTOR STRUCTURE 1 2 3 ________ ________ ________ U1 0.645 0.124 -0.011 U2 0.877 0.013 0.081 U3 0.714 0.004 0.067 U4 -0.049 -0.087 -0.496 U5 -0.215 0.019 -0.547 U6 -0.074 0.093 -0.475 U7 0.040 0.806 -0.022 U8 -0.022 0.721 -0.059 U9 0.015 0.667 -0.036 U10 -0.144 -0.008 0.553 U11 -0.106 -0.113 0.634 U12 0.032 -0.034 0.572
ウェブページで提供されているとサンプルデータだとかなりキレイな感じで分析結果が出るが、他のデータでは問題が起った。
問題が起こった原因までは突き止められていないため、分析ができなかったケースをメモをしておこうと思う。下記で2つのデータで分析をしている。
gss82データ
gss82データはpoLCAパッケージに含まれている。
https://rdrr.io/cran/poLCA/man/gss82.html
このデータはLatentGoldのDfactorモデルの例題でも使われていおり、LatentGoldのアプローチでは分析可能である。
Mplus用のデータに加工
library(poLCA) data(gss82) summary(gss82)
PURPOSE ACCURACY UNDERSTA COOPERAT Good :919 Mostly true:625 Good :980 Interested :1008 Depends :104 Not true :577 Fair/Poor:222 Cooperative: 159 Waste of time:179 Impatient : 35
gaa82unm <- gss82 library(dplyr) gaa82unm %>% mutate(PURPOSE = recode(PURPOSE, "Good" = 1, "Depends" = 2, "Waste of time" = 3)) gaa82unm %>% mutate(ACCURACY = recode(ACCURACY, "Mostly true" = 1, "Not true" = 2)) gaa82unm %>% mutate(UNDERSTA = recode(UNDERSTA, "Good" = 1, "Fair/Poor" = 2)) gaa82unm %>% mutate(COOPERAT = recode(COOPERAT, "Interested" = 1, "Cooperative" = 2, "Impatient" = 3))
library(MplusAutomation) variable.names(gaa82unm)
prepareMplusData(gaa82unm, filename="gaa82unm.dat", overwrite=T)
Mplusのコード
TITLE: factor analysis with categorical factor indicators DATA: FILE = "gaa82unm.dat"; VARIABLE: NAMES = PURPOSE ACCURACY UNDERSTA COOPERAT; CATEGORICAL = PURPOSE ACCURACY UNDERSTA COOPERAT; MISSING=.; ANALYSIS: TYPE = EFA 1 4;
実行
*** WARNING in ANALYSIS command Too many factors were requested for EFA. The maximum number of factors is set to 1. 1 WARNING(S) FOUND IN THE INPUT INSTRUCTIONS
1因子構造での分析のみが許可されているようだ。
児童向けウェクスラー式知能検査
児童向けウェクスラー式知能検査(Wechsler Intelligence Scale for Children; WISC)を用いる。サンプルデータはこちらからダウンロードする。
変数名 | 説明 |
---|---|
info | Information |
comp | Comprehension |
arith | Arithmetic |
simil | Similarities |
vocab | Vocabulary |
digit | Digit Span |
pictcomp | Picture Completion |
parang | Paragraph Arrangement |
block | Block Design |
object | Object Assembly |
coding | Coding |
それぞれの項目は20点満点(0~20)である。
バイナリデータに加工してMplus用に出力する
library(rio) d1 <-import("wiscsem.sav") d2 <- d1[3:13] # 因子分析に使用するのは3~13列目
OneRパッケージで二分割する。
library(OneR) d3 <- bin(d2, nbins = 2, labels = c(0,1), method = "content") summary(d3)
結果。
info comp arith simil vocab digit pictcomp parang block object coding 0:116 0:106 0:107 0:110 0:91 0:94 0:107 0:89 0:88 0:98 0:109 1: 59 1: 69 1: 68 1: 65 1:84 1:81 1: 68 1:86 1:87 1:77 1: 66
Mplus用に出力する。
library(MplusAutomation) variable.names(d3)
prepareMplusData(d3, filename="wiscsem_binary.dat", overwrite=T)
Mplusでの実行
推定器のデフォルトはWLSMVであるが、今回はMLRを使っている。WLSMVで走らせると今回のデータはうまくいかない。Mplus User's Guideの例(https://www.statmodel.com/usersguide/chapter4.shtml)は上手く走るので、WLSMVだからダメというわけではなく、Mplusの手法だと走らないケースが比較的でてくるようだ。
ANALYSISコマンドのESTIMATORオプションを使用すると、別の推定量を選択することができる。 最尤推定では、各因子に対して1次元の積分を行う数値積分が使用される。 https://www.statmodel.com/HTML_UG/chapter4V8.htm
TITLE: factor analysis with categorical factor indicators DATA: FILE = "gaa82unm.dat"; VARIABLE: NAMES = PURPOSE ACCURACY UNDERSTA COOPERAT; CATEGORICAL = PURPOSE-COOPERAT; MISSING=.; ANALYSIS: TYPE = EFA 1 4; ESTIMATOR = WLSMV;
WLSMVの結果
NO CONVERGENCE. NUMBER OF ITERATIONS EXCEEDED. PROBLEM OCCURRED IN EXPLORATORY FACTOR ANALYSIS WITH 3 FACTOR(S). NO CONVERGENCE. NUMBER OF ITERATIONS EXCEEDED. PROBLEM OCCURRED IN EXPLORATORY FACTOR ANALYSIS WITH 4 FACTOR(S).
MLRの結果
PROBLEM OCCURRED IN EXPLORATORY FACTOR ANALYSIS WITH 3 FACTOR(S). THE STANDARD ERRORS OF THE MODEL PARAMETER ESTIMATES MAY NOT BE TRUSTWORTHY FOR SOME PARAMETERS DUE TO A NON-POSITIVE DEFINITE FIRST-ORDER DERIVATIVE PRODUCT MATRIX. THIS MAY BE DUE TO THE STARTING VALUES BUT MAY ALSO BE AN INDICATION OF MODEL NONIDENTIFICATION. STANDARD ERRORS COULD NOT BE COMPUTED IN EXPLORATORY FACTOR ANALYSIS WITH 4 FACTOR(S). SUMMARY OF MODEL FIT INFORMATION Degrees of Models Compared Chi-Square Freedom P-Value 1-factor against 2-factor 20.171 10 0.0277 2-factor against 3-factor 16.778 9 0.0523 3-factor against 4-factor 2412.123 -42 0.0000
MLRだと一応結果は出力されるが、分析には失敗している。
- エラーメッセージが出ている
- 1-factor against 2-factorが0.000というP値で、そこから因子数が増加して、どこかの点で、5%水準より大きなP値になるという結果が正常
- 自由度がマイナスになっている