3 HLM High School and Beyond HLM6 HLM6 C: Program Files HLM6S 2 C: Program MATHACH Files HLM6S Examples AppendxA school SECTOR Socio-Economic

Similar documents
: (EQS) /EQUATIONS V1 = 30*V F1 + E1; V2 = 25*V *F1 + E2; V3 = 16*V *F1 + E3; V4 = 10*V F2 + E4; V5 = 19*V99

Stata11 whitepapers mwp-037 regress - regress regress. regress mpg weight foreign Source SS df MS Number of obs = 74 F(

1 Stata SEM LightStone 3 2 SEM. 2., 2,. Alan C. Acock, Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press.

1 Stata SEM LightStone 4 SEM 4.. Alan C. Acock, Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press 3.

4.9 Hausman Test Time Fixed Effects Model vs Time Random Effects Model Two-way Fixed Effects Model

kubostat2018d p.2 :? bod size x and fertilization f change seed number? : a statistical model for this example? i response variable seed number : { i

1 I EViews View Proc Freeze

講義のーと : データ解析のための統計モデリング. 第5回

第11回:線形回帰モデルのOLS推定

Microsoft Word - 計量研修テキスト_第5版).doc

k3 ( :07 ) 2 (A) k = 1 (B) k = 7 y x x 1 (k2)?? x y (A) GLM (k

講義のーと : データ解析のための統計モデリング. 第3回

% 10%, 35%( 1029 ) p (a) 1 p 95% (b) 1 Std. Err. (c) p 40% 5% (d) p 1: STATA (1). prtesti One-sample test of pr

最小2乗法

Microsoft PowerPoint - GLMMexample_ver pptx

Microsoft Word - 計量研修テキスト_第5版).doc

kubostat2017c p (c) Poisson regression, a generalized linear model (GLM) : :

<4D F736F F D20939D8C7689F090CD985F93C18EEA8D758B E646F63>

一般化線形 (混合) モデル (2) - ロジスティック回帰と GLMM

こんにちは由美子です

Studies of Foot Form for Footwear Design (Part 9) : Characteristics of the Foot Form of Young and Elder Women Based on their Sizes of Ball Joint Girth

第13回:交差項を含む回帰・弾力性の推定

Stata 11 Stata ROC whitepaper mwp anova/oneway 3 mwp-042 kwallis Kruskal Wallis 28 mwp-045 ranksum/median / 31 mwp-047 roctab/roccomp ROC 34 mwp-050 s

1 15 R Part : website:

kubostat2017b p.1 agenda I 2017 (b) probability distribution and maximum likelihood estimation :

Use R

!!! 2!

R John Fox R R R Console library(rcmdr) Rcmdr R GUI Windows R R SDI *1 R Console R 1 2 Windows XP Windows * 2 R R Console R ˆ R

X X X Y R Y R Y R MCAR MAR MNAR Figure 1: MCAR, MAR, MNAR Y R X 1.2 Missing At Random (MAR) MAR MCAR MCAR Y X X Y MCAR 2 1 R X Y Table 1 3 IQ MCAR Y I

σ t σ t σt nikkei HP nikkei4csv H R nikkei4<-readcsv("h:=y=ynikkei4csv",header=t) (1) nikkei header=t nikkei4csv 4 4 nikkei nikkei4<-dataframe(n

,, Poisson 3 3. t t y,, y n Nµ, σ 2 y i µ + ɛ i ɛ i N0, σ 2 E[y i ] µ * i y i x i y i α + βx i + ɛ i ɛ i N0, σ 2, α, β *3 y i E[y i ] α + βx i

第2回:データの加工・整理

Stata 11 Stata ts (ARMA) ARCH/GARCH whitepaper mwp 3 mwp-083 arch ARCH 11 mwp-051 arch postestimation 27 mwp-056 arima ARMA 35 mwp-003 arima postestim

/22 R MCMC R R MCMC? 3. Gibbs sampler : kubo/

Introduction Purpose This training course demonstrates the use of the High-performance Embedded Workshop (HEW), a key tool for developing software for

.. est table TwoSLS1 TwoSLS2 GMM het,b(%9.5f) se Variable TwoSLS1 TwoSLS2 GMM_het hi_empunion totchr

kubostat2017e p.1 I 2017 (e) GLM logistic regression : : :02 1 N y count data or


Microsoft Word - 計量研修テキスト_第5版).doc

Introduction Purpose This training course describes the configuration and session features of the High-performance Embedded Workshop (HEW), a key tool

t sex N y y y Diff (1-2)

Presentation Title Goes Here

DAA09

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

Microsoft Word - Win-Outlook.docx


1 環境統計学ぷらす 第 5 回 一般 ( 化 ) 線形混合モデル 高木俊 2013/11/21

A Nutritional Study of Anemia in Pregnancy Hematologic Characteristics in Pregnancy (Part 1) Keizo Shiraki, Fumiko Hisaoka Department of Nutrition, Sc

(X) (Y ) Y = intercept + c X + e (1) e c c M = intercept + ax + e (2) a Y = intercept + cx + bm + e (3) (1) X c c c (3) b X M Y (indirect effect) a b

Solution Report

Rによる計量分析:データ解析と可視化 - 第3回 Rの基礎とデータ操作・管理


13 Student Software TI-Nspire CX CAS TI Web TI-Nspire CX CAS Student Software ( ) 1 Student Software 37 Student Software Nspire Nspire Nspir

JMP V4 による生存時間分析

浜松医科大学紀要

Cleaner XL 1.5 クイックインストールガイド

現代日本論演習/比較現代日本論研究演習I「統計分析の基礎」

わが国企業による資金調達方法の選択問題

dvi

_念3)医療2009_夏.indd

LM35 高精度・摂氏直読温度センサIC

Microsoft Word - 計量研修テキスト_第5版).doc

Microsoft Word - Meta70_Preferences.doc

1 1.1 (JCPRG) 30 Nuclear Reaction Data File (NRDF) PC GSYS2.4 JCPRG GSYS2.4 Java Windows, Linux, Max OS X, FreeBSD GUI PNG, GIF, JPEG X Y GSYS2

Transcription:

1 2006 5 26 1 S. W. Raudenbush HLM6 student edition SAS/STAT MIXED R 2 HLM6 HLM HLM Hierarchical Linear A. S. Bryk S. W. Raudenbush Models HLM SSI *1 HLM6 student edition *2 student edition HLM6 (1) GUI (2) (3) okumurin@p.u-tokyo.ac.jp *1 http://www.ssicentral.com/home.htm *2 http://www.ssicentral.com/hlm/student.html

3 HLM6 3.1 2 2 High School and Beyond HLM6 HLM6 C: Program Files HLM6S 2 C: Program MATHACH Files HLM6S Examples AppendxA school SECTOR Socio-Economic Status: SES MEANSES MATHACH SES SECTOR MEANSES 2 Raudenbush and Bryk 1 (2002) MATHACH SECTOR SES MEANSES SES 1: 7185 i j SES SES.j j MATHACH SES MAT HACH ij = β 0j + β 1j (SES ij SES.j ) + r ij (1) 2: 160 1 { SECTOR 1 (Catholic) SECT OR = 0 (public) MEANSES β 0j = γ 00 + γ 01 (SECT OR j ) + γ 02 (MEANSES j ) + u 0j (2) β 1j = γ 10 + γ 11 (SECT OR j ) + γ 12 (MEANSES j ) + u 1j (3) 2 2 u 0j, u 1j 1 2 SECTOR, MEANSES

3.2 3.2 HLM6 1. 2. MDMT.mdmt MDM MDM.mdm STS.sts 3. HLM.hlm MLM.mlm 4. 5. 3.3 HLM6 1 2 2 3 2 3 2 HLM6 2 1. ASCII 2. SPSS, SAS, SYSTAT, STATA 3.3.1 ASCII HLM6 ID ID ID ID ID 3

3.3 ID ID 1. 1 (HSB1.DAT) 8 2 (HSB2.DAT) 3.3.2 SPSS SPSS.sav 1 ASCII MDM ASCII ASCII 4

3.4 MDM 1 (HSB1.SAV) 2 (HSB2.SAV) ASCII 3.4 MDM HLM6 MDM Multivariate Data Matrix.mdm MDM MDM MDM HLM5 SSM Sufficient MDM Statistics Matrix 6 ASCII.dat SPSS.sav MDM 5

3.4 MDM 3.4.1 HLM6 HLM6 HLM6 HLM6S WHLMS.exe WHLMS.exe [ ] [ ] HLM6 3.4.2 ASCII MDM ASCII MDM MDM 1 1 [File]-[Make new MDM file]-[ascii input] 6

3.4 MDM [OK] 2 HLM2 Make MDM - HLM2 MDM MDM File Name MDM hsb-gd.mdm Nesting of input data persons within groups Level-1 Specification 1 Level-1 File Name: 1 C: Program Files HLM6S Examples Browse AppendxA hsb1.dat 7

3.4 MDM Number of Variables: ID 4 MDM / Missing Data: Data Format: (A4,4F12.3) ( ) A ID A ID Labels: F 4F12.3 3 4 ID F [ ].[ ] hsb1.dat X / 2 8X 8, ACH Level-2 Specification MINORITY, FEMALE, SES, MATH- 2 1 C: Program Files HLM6S Examples 2 AppendxA hsb2.dat 6 Data Format (A4,6F12.3) Save mdmt file [Save mdmt file] MDMT MDM Template.mdmt SIZE SECTOR PRA- CAD DISCLIM HIM- MDMT MDM *3 INTY MEANSES *4 *3 MDM *4 MDMT MDM [File]-[Make new MDM from old MDM template (.mdmt) file] MDMT MDM 8

3.4 MDM Make MDM [Make MDM] MDM MDM Check Stats [Check Stats] STS hlm2mdm.sts STS Done [Done] MDM MDM [File]-[Display MDM stats] MDM 9

3.4 MDM 3.4.3 SPSS MDM SPSS.sav MDM [File]-[Make new MDM file]-[stat package input] [OK] ASCII 2 HLM2 Make MDM - HLM2 MDM 10

3.4 MDM MDM File Name MDM.mdm hsb-gd.mdm Input File Type SPSS/Windows Nesting of input data persons within groups Level-1 Specification 1 Browse: [Browse] Level-1 File C: Program Files HLM6S Examples Name: AppendxA hsb1.sav Choose Variabes: [Choose Variables] 1 SPSS ID MDM : Missing Data? Yes No Yes hsb1.sav MDM / Level-2 Specification 2 Browse: [Browse] 2 C: Program Files HLM6S Examples AppendxA hsb2.sav Choose Variables: [Choose Variables] 2 11

3.4 MDM Save mdmt file [Save mdmt file] MDM hsb-gd.mdmt Make MDM [Make MDM] MDM MDM Check Stats [Check Stats] STS hlm2mdm.sts STS 12

3.5 Done [Done] MDM 3.5 MDM MDM [File]-[Create HLM6 (1) (3) a new model using an existing GUI HLM6 MDM file] MDM 3.5.1 1 (1) MATHACH SES [Level-1] 1 1 MATHACH Outcome variable MATHACH 13

3.5 SES add variable group centered β 0 2 SES MEANSES HLM6 1 SES Delete variable from model 2 [Level-2] 2 1 β 0 (2) 14

3.6 SECTOR MEANSES uncenterd β 1 (3) SECTOR MEANSES uncenterd 2 u 1 u 1 2 1 3.6 3.6.1 Basic Settings [Basic Settings] [Basic Setting] [Level-1] [Outcome] 15

3.6 [Level-1 Residual File] 16

3.6 Variables in residual file Residual File Type SPSS resfil1.sav Free Format.txt [OK] CSV.csv 2 [Level-2 Residual File] SPSS Excel Variables in residual file 1 Residual File Type SPSS [OK] resfil1.sav resfil2.sav 2 Title no title Output file name HSB-GD Graph file name [OK] 17

3.7 HLM 3.6.2 Other Settings 3.7 HLM HLM.hlm HMLM.mlm [File]-[Save As] HLM 3.8 hsb-gd.hlm [Run Analysis] HLM 3.9 [File]-[View Output] [Basing Settings] hlm2.txt 18

3.9 SPECIFICATIONS FOR THIS HLM2 RUN Problem Title: HSB-GD MDM The data source for this run = hsb-gd.mdm.hlm The command file for this run = C:\Program Files\HLM6S\Examples\AppendxA\hsb-gd.hlm Output file name = C:\Program Files\HLM6S\Examples\AppendxA\hlm2.txt The maximum number of level-1 units = 7185 The maximum number of level-2 units = 160 The maximum number of iterations = 100 Method of estimation: restricted maximum likelihood Weighting Specification ----------------------- Weight Variable Weighting? Name Normalized? Level 1 no Level 2 no Precision no MATHACH The outcome variable is MATHACH The model specified for the fixed effects was: ---------------------------------------------------- Level-1 Level-2 Coefficients Predictors ---------------------- --------------- INTRCPT1, B0 INTRCPT2, G00 SECTOR, G01 MEANSES, G02 * SES slope, B1 INTRCPT2, G10 SECTOR, G11 MEANSES, G12 19

3.9 SES * - This level-1 predictor has been centered around its group mean. The model specified for the covariance components was: --------------------------------------------------------- Sigma squared (constant across level-2 units) Tau dimensions INTRCPT1 SES slope Summary of the model specified (in equation format) --------------------------------------------------- Level-1 Model Y = B0 + B1*(SES) + R Level-2 Model B0 = G00 + G01*(SECTOR) + G02*(MEANSES) + U0 B1 = G10 + G11*(SECTOR) + G12*(MEANSES) + U1 Iterations stopped due to small change in likelihood function ******* ITERATION 61 ******* 1 Sigma_squared = 36.70313 2 Tau INTRCPT1,B0 2.37996 0.19058 SES,B1 0.19058 0.14892 2 Tau (as correlations) INTRCPT1,B0 1.000 0.320 SES,B1 0.320 1.000 1 (Reliability) ---------------------------------------------------- Random level-1 coefficient Reliability estimate ---------------------------------------------------- INTRCPT1, B0 0.733 SES, B1 0.073 ---------------------------------------------------- 1 1 20

3.9 2 The value of the likelihood function at iteration 61 = -2.325094E+004 2 The outcome variable is MATHACH Final estimation of fixed effects: ---------------------------------------------------------------------------- Standard Approx. Fixed Effect Coefficient Error T-ratio d.f. P-value ---------------------------------------------------------------------------- For INTRCPT1, B0 INTRCPT2, G00 12.096006 0.198734 60.865 157 0.000 SECTOR, G01 1.226384 0.306272 4.004 157 0.000 MEANSES, G02 5.333056 0.369161 14.446 157 0.000 For SES slope, B1 INTRCPT2, G10 2.937981 0.157135 18.697 157 0.000 SECTOR, G11-1.640954 0.242905-6.756 157 0.000 MEANSES, G12 1.034427 0.302566 3.419 157 0.001 ---------------------------------------------------------------------------- The outcome variable is MATHACH Final estimation of fixed effects (with robust standard errors) ---------------------------------------------------------------------------- Standard Approx. Fixed Effect Coefficient Error T-ratio d.f. P-value ---------------------------------------------------------------------------- For INTRCPT1, B0 INTRCPT2, G00 12.096006 0.173699 69.638 157 0.000 SECTOR, G01 1.226384 0.308484 3.976 157 0.000 MEANSES, G02 5.333056 0.334600 15.939 157 0.000 For SES slope, B1 INTRCPT2, G10 2.937981 0.147620 19.902 157 0.000 SECTOR, G11-1.640954 0.237401-6.912 157 0.000 MEANSES, G12 1.034427 0.332785 3.108 157 0.003 ---------------------------------------------------------------------------- Final estimation of variance components: ----------------------------------------------------------------------------- Random Effect Standard Variance df Chi-square P-value Deviation Component ----------------------------------------------------------------------------- INTRCPT1, U0 1.54271 2.37996 157 605.29503 0.000 SES slope, U1 0.38590 0.14892 157 162.30867 0.369 level-1, R 6.05831 36.70313 ----------------------------------------------------------------------------- 21

3.10 Deviance Deviance Statistics for current covariance components model -------------------------------------------------- Deviance = 46501.875643 Number of estimated parameters = 4 3.10 HLM6 (1) 1 SECTOR [File]-[Graph Equations]-[Level-1 equation graphing] 1 22

3.10 X-focus Level-1: Number of groups: 1 SES groups All Z-focus SECTOR [OK] Cathoric SECTOR=1 SECTOR 2 21 2 SECTOR INTRCPT1, B0 1.226384 SES slope, B1 1.640954 23

3.11 3.11 HLM6 1 MDM 3.11.1 1 l1resid 1 fitval 2 mathach 24

3.11.2 2 2 eb : ebintrcp 1 β 0j 1 empirical Bayes u 0j ebses 2 1 β 1j u 1j ol 2 ol : olintrcp olses 1 β 0j β 1j 2 ordinary least-squares u 0j u 1j ebintrcp olintrcp eb- eb ses olses fv : 1 2 ec : 1 ( fv ) ( eb 4 SAS PROC MIXED β 0j β 1j ) 23 HLM6 HLM6 1 SAS MIXED 29 R SAS PROC MIXED HLM6 25

4.1 SAS (2) (3) (1) MAT HACH ij = [γ 00 + γ 01 SECT OR j + γ 02 MEANSES j + γ 10 (SES ij SES.j )+ γ 11 SECT OR j (SES ij SES.j )+ γ 12 MEANSES j (SES ij SES.j )]+ [u 0j + u 1j (SES ij SES.j ) + r ij ] (4) [ ] 2 [ ] HLM6 SAS R (4) SAS PROC MIXED Singer (1998) HSB HLM6 4.1 SAS ***************************; * SAS HSB ; * By Taichi OKUMURA ; ***************************; OPTIONS ls = 80; /* */ DATA hsb; INFILE C:\Program Files\SAS Institute\SAS\V8\hsb-sas.dat ; INPUT id school ses mathach meanses cses sector; RUN; /* proc mixed */ PROC MIXED DATA=hsb NOCLPRINT COVTEST; CLASS school; MODEL mathach = sector meanses cses sector*cses meanses*cses / SOLUTION DDFM=bw NOTEST; RANDOM intercept cses / TYPE = un SUB=school; RUN; QUIT; MIXED PROC MIXED NOCLPRINT: COVTEST: school 26

4.2 SAS CLASS school MODEL SOLUTION: DDFM=bw: NOTEST: RANDOM TYPE = un: sub=school: school 4.2 SAS / / SAS The Mixed Procedure Model Information Data Set Dependent Variable Covariance Structure Subject Effect Estimation Method Residual Variance Method Fixed Effects SE Method Degrees of Freedom Method WORK.HSB mathach Unstructured school REML /* REML */ Profile Model-Based Between-Within Dimensions Covariance Parameters 4 Columns in X 6 Columns in Z Per Subject 2 Subjects 160 Max Obs Per Subject 67 Observations Used 7185 Observations Not Used 0 Total Observations 7185 27

4.2 SAS Iteration History Iteration Evaluations -2 Res Log Like Criterion 0 1 46724.22627510 1 2 46503.66454957 0.00000010 2 1 46503.66286827 0.00000000 Convergence criteria met. Covariance Parameter Estimates Standard Z Cov Parm Subject Estimate Error Value Pr Z /* 2 */ UN(1,1) school 2.3794 0.3714 6.41 <.0001 UN(2,1) school 0.1918 0.2043 0.94 0.3479 UN(2,2) school 0.1012 0.2138 0.47 0.3180 /* 1 */ Residual 36.7212 0.6261 58.65 <.0001 Fit Statistics -2 Res Log Likelihood 46503.7 /* deviance */ AIC (smaller is better) 46511.7 AICC (smaller is better) 46511.7 BIC (smaller is better) 46524.0 Null Model Likelihood Ratio Test DF Chi-Square Pr > ChiSq 3 220.56 <.0001 /* 2 */ Solution for Fixed Effects Standard Effect Estimate Error DF t Value Pr > t Intercept 12.1279 0.1993 157 60.86 <.0001 /* G00 */ sector 1.2266 0.3063 157 4.00 <.0001 /* G01 */ meanses 5.3329 0.3692 157 14.45 <.0001 /* G02 */ cses 2.9450 0.1556 7022 18.93 <.0001 /* G10 */ sector*cses -1.6427 0.2398 7022-6.85 <.0001 /* G11 */ meanses*cses 1.0392 0.2989 7022 3.48 0.0005 /* G12 */ 28

5 R R (R Development Core Team, 2005) nmle lme *5 nlme HSB 5.1 SAS HSB 10 school ses mathach meanses cses sector 1 1224-1.528 5.876-0.434383-1.09361702 Public 2 1224-0.588 19.708-0.434383-0.15361702 Public 3 1224-0.528 20.349-0.434383-0.09361702 Public 4 1224-0.668 8.781-0.434383-0.23361702 Public 5 1224-0.158 17.898-0.434383 0.27638298 Public 6 1224 0.022 4.583-0.434383 0.45638298 Public 7 1224-0.618-2.832-0.434383-0.18361702 Public 8 1224-0.998 0.523-0.434383-0.56361702 Public 9 1224-0.888 1.527-0.434383-0.45361702 Public 10 1224-0.458 21.521-0.434383-0.02361702 Public 5.2 R ---------------------------------------------------------------------- R HSB By Taichi OKUMURA ---------------------------------------------------------------------- nlme library(nlme) 1 data(mathachieve) MathAchieve[1:10,] 2 data(mathachschool) MathAchSchool[1:10,] SES mses attach(mathachieve) *5 http://socserv.socsci.mcmaster.ca/jfox/books/companion/appendix-mixedmodels.pdf 29

5.3 R mses <- tapply(ses, School, mean) detach(mathachieve) HSB HSB <- as.data.frame(mathachieve[, c("school", "SES", "MathAch")]) names(hsb) <- c("school", "ses", "mathach") SES mses HSB$meanses <- mses[as.character(hsb$school)] HSB$cses <- HSB$ses - HSB$meanses sector HSB sector <- MathAchSchool$Sector names(sector) <- row.names(mathachschool) HSB$sector <- sector[as.character(hsb$school)] HSB$sector <- factor(hsb$sector, levels=c( Public, Catholic )) result.hsb result.hsb <- lme(mathach ~ sector + meanses + cses + sector*cses + meanses*cses, random = ~ cses school, data = HSB) summary(result.hsb) 5.3 R / / Linear mixed-effects model fit by REML /* REML */ Data: HSB AIC BIC loglik 46523.66 46592.45-23251.83 /* LogLik -2 deviance */ Random effects: Formula: ~cses school Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 1.5426150 (Intr) /* 2 */ cses 0.3182015 0.391 /* 2 */ Residual 6.0597955 /* 1 */ /* 2 */ Fixed effects: mathach ~ sector + meanses + cses + sector * cses + meanses * cses Value Std.Error DF t-value p-value (Intercept) 12.127931 0.1992920 7022 60.85510 0e+00 /* G00 */ sectorcatholic 1.226579 0.3062733 157 4.00485 1e-04 /* G01 */ meanses 5.332875 0.3691684 157 14.44564 0e+00 /* G02 */ cses 2.945041 0.1556005 7022 18.92694 0e+00 /* G10 */ sectorcatholic:cses -1.642674 0.2397800 7022-6.85076 0e+00 /* G11 */ meanses:cses 1.039230 0.2988971 7022 3.47688 5e-04 /* G12 */ Correlation: (Intr) sctrct meanss cses sctrc: sectorcatholic -0.699 meanses 0.256-0.356 cses 0.075-0.053 0.019 30

REFERENCES sectorcatholic:cses -0.052 0.077-0.027-0.696 meanses:cses 0.019-0.026 0.074 0.293-0.351 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -3.1592608-0.7231893 0.0170471 0.7544510 2.9582205 Number of Observations: 7185 /* */ Number of Groups: 160 /* */ References R Development Core Team. (2005). R: A language and environment for statistical computing. Vienna, Austria. (ISBN 3-900051-07-0) Raudenbush, S. W., & Bryk, A. S. (2002). Hierarchical linear models: Applications and data analysis methods (2nd ed.). Sage. Singer, J. D. (1998). Using SAS PROC MIXED to fit multilevel models, hierarchical models, and individual growth models. Journal of Educational and Behavioral Statistics, 24, 323-355. 31