Presentation is loading. Please wait.

Presentation is loading. Please wait.

因子分析,共分散構造分析 Factor Analysis Structural Equations Model

Similar presentations


Presentation on theme: "因子分析,共分散構造分析 Factor Analysis Structural Equations Model"— Presentation transcript:

1 因子分析,共分散構造分析 Factor Analysis Structural Equations Model
     主成分分析 Principal Components 第17章 共分散構造分析 Structural Equations Model (SEM) 1

2 線形構造の図式(p310) Linear Structure
観測変数 Observed V. 潜在変数 Latent V. 誤差項 Error term 重回帰分析 Multiple Linear Regression (複数の観測変数と誤差で目的の観測変数を表現) x1 y e x2 因子分析 Factor Analysis (複数の観測変数を 共通の潜在変数で表現) 主成分分析 Principal Components (複数の観測変数を統合し 集約した潜在変数で表現) y1 e1 x1 f1 h1 e1 y2 x2 e2 h2 e2 f2 y3 x3 e3 2

3 線形構造の図式(p310) Linear Structure
観測変数 Observed V. 潜在変数 Latent V. 誤差項 Error term 一般線形構造 General Structure δ2 y1 e1 f2 e4 y4 y2 e2 f1 f3 y3 e3 y5 e5 Structural Equation Model (SEM), Linear Structure Regression with Latent variables(LISREL) δ3 3

4 線形構造の図式(p310) Linear Structure
誤差項 Error Term 観測変数 Observed V. 潜在変数 Latent V. y5 一般線形構造 e5 y6 e6 δ2 y7 e7 f2 e1 y1 y8 e8 f1 y2 e2 f3 y9 e9 e3 y3 y10 e10 δ3 y4 y11 e4 e11 y12 e12

5 パッケージを使う Use Additional Package
(1) SEM (Structual Equations Model) From Package Menu  メニューから Select a Mirror Site CRANミラーサイト指定 Install the package  プルダウンから選ぶ Type from Command Line コマンドラインから install.packages("sem") Make a Library in the Package Effective パッケージ内のライブラリーを有効にする library(sem)

6 パッケージを使う Use Additional Package
(2) Lavaan (latent variable analysis) From Package Menu  メニューから Select a Mirror Site CRANミラーサイト指定 Type from Command Line コマンドラインから install.packages(c("lavaan", "psych", "qgraph")) Make a Library in the Package Effective library(lavaan) library(psych) library(qgraph)

7 相関係数行列入力(p312) Specify The Correlation Coefficient Matrix
# p312 specify the correlation coefficient matrix (as lower triangular matrix) coopd<- readMoments(names=c( "y1","y2","y3","y4","y5","y6","y7","y8","y9","y10","y11","y12")) 1.0

8 相関係数行列の入力(p313) Specify The Correlation Coefficient Matrix (Alt)
# p312 specify the correlation coefficient matrix (without diagonal values) coopd <- readMoments (diag=FALSE,names=as.character(paste("y",1:12, sep=""))) .160

9 SEMpackege Description of Equations 方程式の記述
model.coop <- specifyModel() mother -> y1, b11, NA mother-> y2, b21, NA mother-> y3, b31, NA mother-> y4, b41, NA interaction-> y5, NA, 1 interaction-> y6, b62, NA interaction-> y7, b72, NA interaction-> y8, b82, NA cooperative -> y9, NA, 1 cooperative -> y10, b103, NA cooperative -> y11, b113, NA cooperative -> y12, b123, NA mother-> interaction, g21, NA mother-> cooperative, g31, NA y1 <-> y1, e1, NA y2 <-> y2, e2, NA y3 <-> y3, e3, NA y4 <-> y4, e4, NA y5 <-> y5, e5, NA y6 <-> y6, e6, NA y7 <-> y7, e7, NA y8 <-> y8, e8, NA y9 <-> y9, e9, NA y10 <-> y10, e10, NA y11 <-> y11, e11, NA y12 <-> y12, e12, NA mother<-> mother, NA, 1 interaction<-> interaction, delta2, NA cooperative <-> cooperative, delta3, NA

10 Description of Relations(係数の記述) 変数 -> 影響先,推定母数,固定母数 variable -> variable , estimated, fixed
model.coop <- specifyModel() mother -> y1, b11, NA mother-> y2, b21, NA mother-> y3, b31, NA mother-> y4, b41, NA interaction-> y5, NA, 1 interaction-> y6, b62, NA interaction-> y7, b72, NA interaction-> y8, b82, NA cooperative -> y9, NA, 1 cooperative -> y10, b103, NA cooperative -> y11, b113, NA cooperative -> y12, b123, NA mother-> interaction, g21, NA mother-> cooperative, g31, NA

11 Descrition of Variances(分散の記述) 内生変数の分散(変数<->変数),推定母数,固定母数 Variance of Endogenous Variables variable <-> variable, estimated parameter, fixed param. y1 <-> y1, e1, NA y2 <-> y2, e2, NA y3 <-> y3, e3, NA y4 <-> y4, e4, NA y5 <-> y5, e5, NA y6 <-> y6, e6, NA y7 <-> y7, e7, NA y8 <-> y8, e8, NA y9 <-> y9, e9, NA y10 <-> y10, e10, NA y11 <-> y11, e11, NA y12 <-> y12, e12, NA mother<-> mother, NA, 1 interaction<-> interaction, delta2, NA cooperative <-> cooperative, delta3, NA

12 SEM Package 推定母数の計算 sem(モデル名,相関係数行列,データ数)
sem.coop <- sem(model.coop, coopd, N=50) 推定結果の表示 Show the result stdCoef(sem.coop) summary(sem.coop)

13 適合度指標 一般に、カイ二乗値、GFI、AGFI、RMSEA、CFI、AIC,CAIC、BIC などが使われる。(たぶん)まずはRMSEA、それからCFI。で、AICでほかのモデルと比較する。カイ二乗値、GFI系はいろいろよくないらしいが、慣習として (?) 報告だけはしておく。 カイ二乗値:小さくて、有意じゃないとよい。75から200ケースくらいならよいが、それ以上になると常に有意になってしまうのでよろしくない指標。 GFI: Goodness of Fit Index 。0から1までの値で、大きいほどよい。サンプルサイズに依存するのでおすすめしない。 AGFI: Adjusted Goodness of Fit Index。0から1までの値で、大きいほどよい。サンプルサイズに依存するのでおすすめしない。 RMSEA: Root Mean Square Error of Approximation。 0.05以下だとよい。信頼区間の計算を薦める。sqrt([([&chi2/df] - 1)/(N - 1)]) NFI: Normed Fit Index。ヌルモデルとの差。大きいほど、0.95以上だとよい。[&chi2/df(Null Model) - &chi2/df(Proposed Model)]/[&chi2/df(Null Model) - 1] TFI: Tucker-Lewis Index。NFIを自由度で補正。大きいほどよい。1を超えることもある CFI: Comparative Fit Index。NFIを自由度で補正 (TFIとは違うやりかた) 。大きいほどよい。0.95以上だとよい。[d(Null Model) - d(Proposed Model)]/d(Null Model) AIC: Akaike Information Criterion。カイ二乗値に自由度、パラメータ数の補正を加えたもの。小さいほうがよい。相対基準なので、いくつ以下、というのはない。 chi2 + k(k - 1) - 2df CAIC: Consistent Akaike Information Criterion。AICのサンプルサイズの補正をさらに加えた。X2+(1+log(N))*(((k*(k-1)-2*df))/2)。Nはサンプルサイズ。 BIC: Bayesian Information Criterion。事後の分布との比較。小さいほどよい。chi2 + [k(k - 1)/2 - df]ln(N)

14 SEM Package 標準化解 15 e1 0.81523858 y1 <--> y1
   stdCoef(sem.coop, digit=4) Std. Estimate 1 b y1 <--- mother 2 b y2 <--- mother 3 b y3 <--- mother 4 b y4 <--- mother y5 <--- interaction 6 b y6 <--- interaction 7 b y7 <--- interaction 8 b y8 <--- interaction y9 <--- cooperative 10 b y10 <--- cooperative 11 b y11 <--- cooperative 12 b y12 <--- cooperative 13 g interaction <--- mother 14 g cooperative <--- mother e y1 <--> y1 e y2 <--> y2 e y3 <--> y3 e y4 <--> y4 e y5 <--> y5 e y6 <--> y6 e y7 <--> y7 e y8 <--> y8 e y9 <--> y9 24 e y10 <--> y10 25 e y11 <--> y11 26 e y12 <--> y12 mother <--> mother 28 delta interaction <--> interaction 29 delta cooperative <--> cooperative

15 summary(sem.coop) Model Chisquare = Df = 52 Pr(>Chisq) = Chisquare (null model) = Df = 66 Goodness-of-fit index = Adjusted goodness-of-fit index = RMSEA index = % CI: ( , ) Bentler-Bonnett NFI = Tucker-Lewis NNFI = Bentler CFI = SRMR = AIC = AICc = BIC = CAIC = Normalized Residuals Min. 1st Qu. Median Mean 3rd Qu. Max. R-square for Endogenous Variables y y y y4 interaction y5 y y y8 cooperative y y10 y y12 Parameter Estimates Estimate Std Error z value Pr(>|z|) b e-03 y1 <--- mother b e-03 y2 <--- mother b e-09 y3 <--- mother b e-04 y4 <--- mother b e-11 y6 <--- interaction b e-09 y7 <--- interaction b e-18 y8 <--- interaction b e-03 y10 <--- cooperative b e-03 y11 <--- cooperative b e-03 y12 <--- cooperative g e-06 interaction <--- mother g e-03 cooperative <--- mother e e-06 y1 <--> y1 e e-06 y2 <--> y2 e e-03 y3 <--> y3 e e-06 y4 <--> y4 e e-05 y5 <--> y5 e e-05 y6 <--> y6 e e-06 y7 <--> y7 e e-01 y8 <--> y8 e e-05 y9 <--> y9 e e-05 y10 <--> y10 e e-04 y11 <--> y11 e e-05 y12 <--> y12 delta e-03 interaction <--> interaction delta e-01 cooperative <--> cooperative Iterations = 48

16 pathDiagram(sem. coop, ignore. double=FALSE, edge
pathDiagram(sem.coop, ignore.double=FALSE, edge.labels="values", digits=3) > pathDiagram(sem.coop, ignore.double=FALSE, edge.labels="values", digits=3) digraph "sem.coop" { rankdir=LR; size="8,8"; node [fontname="Helvetica" fontsize=14 shape=box]; edge [fontname="Helvetica" fontsize=10]; center=1; "interaction" [shape=ellipse] "cooperative" [shape=ellipse] "mother" [shape=ellipse] "mother" -> "y1" [label="0.43"]; "mother" -> "y2" [label="0.488"]; "mother" -> "y3" [label="0.799"]; "mother" -> "y4" [label="0.521"]; "interaction" -> "y5" [label="1"]; "interaction" -> "y6" [label="0.937"]; "interaction" -> "y7" [label="0.858"]; "interaction" -> "y8" [label="1.138"]; "cooperative" -> "y9" [label="1"]; "cooperative" -> "y10" [label="1.155"]; "cooperative" -> "y11" [label="1.239"]; "cooperative" -> "y12" [label="1.097"]; "mother" -> "interaction" [label="0.597"]; "mother" -> "cooperative" [label="0.39"]; "y1" -> "y1" [label="0.815" dir=both]; "y2" -> "y2" [label="0.762" dir=both]; "y3" -> "y3" [label="0.361" dir=both]; "y4" -> "y4" [label="0.729" dir=both]; "y5" -> "y5" [label="0.298" dir=both]; "y6" -> "y6" [label="0.383" dir=both]; "y7" -> "y7" [label="0.484" dir=both]; "y8" -> "y8" [label="0.091" dir=both]; "y9" -> "y9" [label="0.708" dir=both]; "y10" -> "y10" [label="0.61" dir=both]; "y11" -> "y11" [label="0.552" dir=both]; "y12" -> "y12" [label="0.649" dir=both]; "mother" -> "mother" [label="1" dir=both]; "interaction" -> "interaction" [label="0.345" dir=both]; "cooperative" -> "cooperative" [label="0.14" dir=both]; } >

17 lavaan packege Description of Equations 方程式の記述
model.cooplv <- ' mother =~ y1+y2+y3+y4 interaction =~ y5+y6+y7+y8 cooperative =~ y9+y10+y11+y12 interaction ~ mother cooperative ~ mother ' {lavaan}パッケージでは以下のような記号の使い方をしています。 =~ 測定方程式 ~  構造程式(回帰) ~~ 残差の共分散(相関)

18 lavaan Package Estimation
result2 <- sem(model.cooplv,sample.cov=coopd, sample.nobs=50) summary(result2, fit.measures=TRUE, standardized=TRUE)

19 Estimated result from Lavaan
summary(result2) lavaan (0.5-11) converged normally after 45 iterations Number of observations 50 Estimator ML Minimum Function Test Statistic Degrees of freedom 51 P-value (Chi-square) Parameter estimates: Information Expected Standard Errors Standard Estimate Std.err Z-value P(>|z|) Latent variables: mother =~ y y y y interaction =~ y y y y cooperative =~ y y y y Regressions: interaction ~ mother cooperative ~ mother Covariances: interaction ~~ cooperative

20 Estimated result from Lavaan
diagram(result2, errors=TRUE, lr=FALSE) Variances: y y y y y y y y y y y y mother interaction cooperative

21 Estimated result from Lavaan


Download ppt "因子分析,共分散構造分析 Factor Analysis Structural Equations Model"

Similar presentations


Ads by Google