Contents

1
2 一危
3 螻 覈(Hierarchical Linear Model)
4 谿瑚襭


1 #

  • 蟲 螻 螳 螻襯 螳 襭れ 覿
  • 讌伎 覿, 讌螳 覿
  • 螳語 覲, 讌 覲

れ元覈(Multilevel Models 螻覈(Hierarchical Linear Models: HLM)) 襭伎 覲語 讌 伎 襭襯 覿 覈. 螳 螳(, ) 襭螳 譟一(蟲, ) 襭 襭襯 れ元襭手 . 企 襭 れ元覈 覃 螳 螳語 蟆郁骸覲襯 螳誤轟炎骸 譟一轟, 蠏碁Μ螻 螳瑚骸 譟一 伎 語朱 る 給. 螳語 蟆郁骸襯 螳誤轟煙朱襷 る 蟆 螻 螳語 襷ル渚螻(蟆)蟾讌 螻ろる れ元覈 襷れ 一る 覈. 譴 襭 覦 譟一譴 朱 螳語 給. 襯 る れ元蟲譟磯ゼ 企0 朱 豺襭螻殊 螳 蟆郁骸覲 轟, 轟, 伎 語朱 る 給.
-- http://koreanpsychology.or.kr/enterschool/bbs_view.asp?Ipage=5&Iseq=4595

2 一危 #

hlm_data_0.zip [http](http://txcdk.unt.edu/iralab/sites/default/files/hlm_data_0.csv)
hlm <- read.csv("c:\\rdata\\hlm_data_0.csv")
head(hlm)

蟆郁骸
> head(hlm)
  schid minority female    ses mathach size schtype meanses
1  1224        0      1 -1.528   5.876  842       0  -0.428
2  1224        0      1 -0.588  19.708  842       0  -0.428
3  1224        0      0 -0.528  20.349  842       0  -0.428
4  1224        0      0 -0.668   8.781  842       0  -0.428
5  1224        0      0 -0.158  17.898  842       0  -0.428
6  1224        0      0  0.022   4.583  842       0  -0.428
  • 譴(level-1)
    • minority: 覩殊 ̄(minority=1, other=0)
    • female: 焔(female=1, 0=male)
    • ses: 覦郁化(覿覈 蟲′譴, 讌, )
    • mathach: 煙
  • 蟲譴(level-2)
    • size:
    • schid: 蟲覲
    • schtype: る曙(sector), 螻給 豺危襴=1(public or catholic)
    • meanses: ses 蠏

3 螻 覈(Hierarchical Linear Model) #

library("nlme")
#run the intercepts-and slope-as-outcomes model
ctrl <- lmeControl(opt='optim');
model2 <- lme(mathach~meanses*ses + schtype*ses, random=~ses | schid, data=hlm, control=ctrl)
summary(model2)
VarCorr(model2)

谿瑚: lme() 螳 覃讌螳 蟆曙 lmeControl(opt='optim')襯 伎 危伎.
Error in lme.formula(mathach ~ meanses * ses + schtype * ses, random = ~ses |  : 
  nlminb problem, convergence error code = 1
  message = iteration limit reached without convergence (10)

蟆郁骸
> summary(model2)
Linear mixed-effects model fit by REML
 Data: hlm 
       AIC   BIC    logLik
  46526.21 46595 -23253.11

Random effects:
 Formula: ~ses | schid
 Structure: General positive-definite, Log-Cholesky parametrization
            StdDev      Corr  
(Intercept) 1.545996356 (Intr)
ses         0.007858279 0.004 
Residual    6.063711572       

Fixed effects: mathach ~ meanses * ses + schtype * ses 
                Value Std.Error   DF  t-value p-value
(Intercept) 12.093477 0.2023257 7022 59.77232  0.0000
meanses      3.304206 0.3871145  157  8.53548  0.0000
ses          2.902136 0.1479089 7022 19.62110  0.0000
schtype      1.199009 0.3072555  157  3.90232  0.0001
meanses:ses  0.835240 0.2714756 7022  3.07667  0.0021
ses:schtype -1.576624 0.2241463 7022 -7.03391  0.0000
 Correlation: 
            (Intr) meanss ses    schtyp mnss:s
meanses      0.216                            
ses         -0.002 -0.167                     
schtype     -0.676 -0.344 -0.007              
meanses:ses -0.165  0.093  0.281 -0.051       
ses:schtype -0.004 -0.051 -0.680  0.007 -0.357

Standardized Within-Group Residuals:
        Min          Q1         Med          Q3         Max 
-3.15472213 -0.72530262  0.01492044  0.75492174  2.99227664 

Number of Observations: 7185
Number of Groups: 160 
> VarCorr(model2)
schid = pdLogChol(ses) 
            Variance     StdDev      Corr  
(Intercept) 2.390105e+00 1.545996356 (Intr)
ses         6.175254e-05 0.007858279 0.004 
Residual    3.676860e+01 6.063711572       
> 
  • intraclass correlation:讌 蟯螻, 讌 伎 覦 る 覲 覲 觜
    • 0.06103636 = 2.390105e+00 / (2.390105e+00+3.676860e+01)
    • (Intercept): 讌 螳 覲 (蟲螳 覲)
    • Residual:蟆郁骸 覲語 讌 覲 (蟲 覲)
  • random effect 螳 蟲覲(schid) 螳 覦郁化(ses) 煙螻殊 蟯螻(Corr)螳 0.004襦 覲 蟯螻螳 . Fixed effects るジ 覲碁れ p-value 0.05 危襦 覩誤. 讀, 煙 レ 殊.

4 谿瑚襭 #