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 危襦 覩誤. 讀, 煙 レ 殊.