Use the dataset “IN_cohort2” to answer the following questions.
\(mathstd=β_{0j}+r_{ij}\)
\(β_{0j}=γ_{00}+u_{0j}\)
UnconditionalModel <-lme(mathstd ~ 1, data = IN_cohort2, random = ~1|schid, na.action=na.exclude, method = "ML")
summary(UnconditionalModel)
## Linear mixed-effects model fit by maximum likelihood
## Data: IN_cohort2
## AIC BIC logLik
## 8433.836 8451.948 -4213.918
##
## Random effects:
## Formula: ~1 | schid
## (Intercept) Residual
## StdDev: 0.4046758 0.9222185
##
## Fixed effects: mathstd ~ 1
## Value Std.Error DF t-value p-value
## (Intercept) 0.01552588 0.05216712 3024 0.2976182 0.766
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -5.07301213 -0.59538977 0.01597355 0.59104393 4.09460776
##
## Number of Observations: 3094
## Number of Groups: 70
UnconditionalModel_ICC <- 0.40^2/(0.40^2+0.92^2)
UnconditionalModel_ICC
## [1] 0.1589825
\(mathstd=β_{0j}+r_{ij}\)
\(β_{0j}=γ_{00}+γ_{01}T_j+u_{0j}\)
TwoLevelModel1 <-lme(mathstd ~ assignment, data = IN_cohort2, random = ~1|schid, na.action=na.exclude, method = "ML")
summary(TwoLevelModel1)
## Linear mixed-effects model fit by maximum likelihood
## Data: IN_cohort2
## AIC BIC logLik
## 8435.483 8459.632 -4213.741
##
## Random effects:
## Formula: ~1 | schid
## (Intercept) Residual
## StdDev: 0.4033057 0.9222269
##
## Fixed effects: mathstd ~ assignment
## Value Std.Error DF t-value p-value
## (Intercept) 0.04750448 0.07479054 3024 0.6351669 0.5254
## assignment -0.06193160 0.10409847 68 -0.5949329 0.5539
## Correlation:
## (Intr)
## assignment -0.718
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -5.07745405 -0.59704379 0.01198187 0.58849214 4.09941852
##
## Number of Observations: 3094
## Number of Groups: 70
\(mathstd=.05-.06T_j\)
\(γ_{00}=.05, t(3024)=.64, p=.53\), the average intercept across schools is .05 and insignificant.
\(γ_{01}=-.06, t(68)=-.59, p=.55\),the average treatment slope across schools is -.06 and insignificant.
logLik(UnconditionalModel)*-2
## 'log Lik.' 8427.836 (df=3)
logLik(TwoLevelModel1)*-2
## 'log Lik.' 8427.483 (df=4)
\(∆x^2=[−2LogLikelihoodOld(−2LLOld)]-[−2LogLikelihoodNew(−2LLNew)]=8427.836-8427.483=.353\)
\(∆df=4-3=1\) When we look at the critical value for the chi-square statistic with 1 degree of freedom, it is 3.84 (p <.05); therefore, this change is insignificant, indicating the 2-level model does not fit our data very well.
\(mathstd=β_{0j}+β_{1j}female+β_{2j}minor+β_{3j}ses+r_{ij}\)
\(β_{0j}=γ_{00}+γ_{01}T_j+u_{0j}\)
\(β_{1j}=γ_{10}\) \(β_{2j}=γ_{20}\) \(β_{3j}=γ_{30}\) The mixed model is: \(mathstd=γ_{00}+γ_{01}T_j+u_{0j}+γ_{10}female+γ_{20}minor+γ_{30}ses+r_{ij}\)
TwoLevelModel2 <-lme(mathstd ~ assignment+female+minor+ses, data = IN_cohort2, random = ~1|schid, na.action=na.exclude, method = "ML")
summary(TwoLevelModel2)
## Linear mixed-effects model fit by maximum likelihood
## Data: IN_cohort2
## AIC BIC logLik
## 7877.887 7919.847 -3931.944
##
## Random effects:
## Formula: ~1 | schid
## (Intercept) Residual
## StdDev: 0.2791188 0.8954517
##
## Fixed effects: mathstd ~ assignment + female + minor + ses
## Value Std.Error DF t-value p-value
## (Intercept) 0.4328724 0.06256248 2891 6.919041 0.0000
## assignment -0.0807883 0.07680020 68 -1.051929 0.2966
## female -0.0151568 0.03331468 2891 -0.454960 0.6492
## minor -0.3771224 0.04360377 2891 -8.648848 0.0000
## ses -0.3158316 0.03793187 2891 -8.326286 0.0000
## Correlation:
## (Intr) assgnm female minor
## assignment -0.635
## female -0.261 0.001
## minor -0.216 0.011 -0.020
## ses -0.258 0.000 -0.003 -0.266
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -5.1123173 -0.5898472 -0.0141845 0.5738602 4.0533483
##
## Number of Observations: 2964
## Number of Groups: 70
\(mathstd=.43-.08T_j-.02female-.38minor-.32ses\) \(γ_{00}=.42, t(2891)=6.92, p<.01\), the average intercept across schools is .43 and significant.
\(γ_{01}=-.08, t(68)=-1.05, p=.30\),the average treatment slope across schools is -.08 and insignificant. Compared with \(γ_{01}=-.06\) of TwoLevelModel1, the treatment slope is larger here.
\(γ_{10}=-.02, t(2891)=-.45, p=.65\),the average gender slope across schools is -.02 and insignificant.
\(γ_{20}=-.38, t(2891)=-8.65, p<.01\),the average minority slope across schools is -.38 and significant.
\(γ_{20}=-.32, t(2891)=-8.33, p<.01\),the average SES slope across schools is -.32 and significant.
#2. Multisite RCT. Use the dataset “Star_gradeK” to answer the following questions. This dataset is from the Project STAR. There are two treatment conditions (small classes and regular classes with teacher aid).
\(mathkstd=β_{0j}+r_{ij}\)
\(β_{0j}=γ_{00}+u_{0j}\)
UnconditionalModel <-lme(mathkstd ~ 1, data = Star_gradeK, random = ~1|schidk, na.action=na.exclude, method = "ML")
summary(UnconditionalModel)
## Linear mixed-effects model fit by maximum likelihood
## Data: Star_gradeK
## AIC BIC logLik
## 15608.07 15628.1 -7801.035
##
## Random effects:
## Formula: ~1 | schidk
## (Intercept) Residual
## StdDev: 0.4451156 0.895979
##
## Fixed effects: mathkstd ~ 1
## Value Std.Error DF t-value p-value
## (Intercept) 0.002567947 0.05155333 5792 0.04981146 0.9603
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -4.64702311 -0.65404766 -0.06359811 0.58188930 4.36692249
##
## Number of Observations: 5871
## Number of Groups: 79
UnconditionalModel_ICC <- 0.45^2/(0.45^2+0.90^2)
UnconditionalModel_ICC
## [1] 0.2
\(mathkstd=β_{0j}+r_{ij}\)
\(β_{0j}=γ_{00}+γ_{01}smallk_j+γ_{02}bigaidk_j+u_{0j}\)
The mixed model is:
\(mathkstd=γ_{00}+γ_{01}smallk_j+γ_{02}bigaidk_j+u_{0j}+r_{ij}\)
TwoLevelModel1 <-lme(mathkstd ~ smallk + bigaidk, data = Star_gradeK, random = ~1|schidk, na.action=na.exclude, method = "ML")
summary(TwoLevelModel1)
## Linear mixed-effects model fit by maximum likelihood
## Data: Star_gradeK
## AIC BIC logLik
## 15561.37 15594.76 -7775.685
##
## Random effects:
## Formula: ~1 | schidk
## (Intercept) Residual
## StdDev: 0.4464849 0.8920339
##
## Fixed effects: mathkstd ~ smallk + bigaidk
## Value Std.Error DF t-value p-value
## (Intercept) -0.05508841 0.05421940 5790 -1.016028 0.3097
## smallk 0.18611495 0.02948525 5790 6.312137 0.0000
## bigaidk 0.00523587 0.02828000 5790 0.185144 0.8531
## Correlation:
## (Intr) smallk
## smallk -0.254
## bigaidk -0.266 0.489
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -4.83046405 -0.65396032 -0.07075802 0.57514143 4.24471646
##
## Number of Observations: 5871
## Number of Groups: 79
\(mathkstd=.06+.19smallk+.01bigaidk\)
\(γ_{00}=-.06, t(5790)=-1.02, p=.31\), the average intercept across schools is -.06 and insignificant.
\(γ_{01}=.19, t(5790)=6.31, p<.01\), the average “small classes”" treatment slope across schools is .19 and significant.
\(γ_{02}=.01, t(5790)=.19, p=.85\), the average “big classes with aid”" treatment slope across schools is .01 and insignificant.
logLik(UnconditionalModel)*-2
## 'log Lik.' 15602.07 (df=3)
logLik(TwoLevelModel1)*-2
## 'log Lik.' 15551.37 (df=5)
\(∆x^2=[−2LogLikelihoodOld(−2LLOld)]-[−2LogLikelihoodNew(−2LLNew)]=15602.07-15551.37=50.7\)
\(∆df=5-3=2\) When we look at the critical value for the chi-square statistic with 2 degrees of freedom, it is 5.99 (p <.05); therefore, this change is significant, indicating that the 2-level model fits our data better than the unconditional model.
\(mathkstd=β_{0j}+β_{1j}femalek+β_{2j}lowsesk+β_{3j}minork+r_{ij}\)
\(β_{0j}=γ_{00}+γ_{01}smallk_j+γ_{02}bigaidk_j+u_{0j}\)
\(β_{1j}=γ_{10}\)
\(β_{2j}=γ_{20}\)
\(β_{3j}=γ_{30}\)
The mixed model is:
\(mathkstd=γ_{00}+γ_{01}smallk_j+γ_{02}bigaidk_j+u_{0j}+γ_{10}femalek+γ_{20}lowsesk+γ_{30}minork+r_{ij}\)
TwoLevelModel2 <-lme(mathkstd ~ smallk + bigaidk + femalek + lowsesk + minork, data = Star_gradeK, random = ~1|schidk, na.action=na.exclude, method = "ML")
summary(TwoLevelModel2)
## Linear mixed-effects model fit by maximum likelihood
## Data: Star_gradeK
## AIC BIC logLik
## 15155.66 15209.05 -7569.828
##
## Random effects:
## Formula: ~1 | schidk
## (Intercept) Residual
## StdDev: 0.4292694 0.8649663
##
## Fixed effects: mathkstd ~ smallk + bigaidk + femalek + lowsesk + minork
## Value Std.Error DF t-value p-value
## (Intercept) 0.1700896 0.05591777 5768 3.041781 0.0024
## smallk 0.1871025 0.02863577 5768 6.533873 0.0000
## bigaidk 0.0122400 0.02747568 5768 0.445485 0.6560
## femalek 0.1387245 0.02278237 5768 6.089114 0.0000
## lowsesk -0.4220449 0.02741602 5768 -15.394100 0.0000
## minork -0.3159733 0.04481476 5768 -7.050652 0.0000
## Correlation:
## (Intr) smallk bigadk femalk lowssk
## smallk -0.240
## bigaidk -0.247 0.489
## femalek -0.196 0.000 0.001
## lowsesk -0.179 -0.002 -0.012 -0.002
## minork -0.196 0.007 -0.004 -0.010 -0.202
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -4.8455293 -0.6732865 -0.0677937 0.5827861 3.9760356
##
## Number of Observations: 5852
## Number of Groups: 79
\(mathkstd=.17+.19smallk+.01bigaidk+.14femalek-.42lowsesk-.32minork\)
\(γ_{00}=.17, t(5768)=3.04, p<.01\), the average intercept across schools is .17 and significant.
\(γ_{01}=.19, t(5768)=6.53, p<.01\), the average “small classes” treatment slope across schools is .19 and significant. Compared with \(γ_{01}=.19\) of TwoLevelModel1, the treatment slope is similar here.
\(γ_{02}=.01, t(5768)=.45, p=.66\), the average “big classes with aid” treatment slope across schools is .01 and insignificant. Compared with \(γ_{02}=.01\) of TwoLevelModel1, the treatment slope is also similar here.
\(γ_{10}=.14, t(5768)=6.09, p<.01\), the average gender slope across schools is .14 and significant.
\(γ_{20}=-.42, t(5768)=-15.39, p<.01\), the average minority slope across schools is -.42 and significant.
\(γ_{20}=-.32, t(5768)=-7.05, p<.01\), the average SES slope across schools is -.32 and significant.
Use the dataset “Star_k_3” to answer the following questions.
\(math=α_{0jl}+ϵ_{ijl}\)
\(α_{0jl}=β_{00l}+r_{0jl}\)
\(β_{00l}=γ_{000}+u_{00l}\)
The mixed model is:
\(math=γ_{000}+u_{00l}+r_{0jl}+ϵ_{ijl}\)
UnconditionalModel <-lme(math ~ 1, data = Star_k_3, random = ~1|schid3/stid9, na.action=na.exclude, method = "ML")
summary(UnconditionalModel)
## Linear mixed-effects model fit by maximum likelihood
## Data: Star_k_3
## AIC BIC logLik
## 24500.04 24529.14 -12246.02
##
## Random effects:
## Formula: ~1 | schid3
## (Intercept)
## StdDev: 0.3530358
##
## Formula: ~1 | stid9 %in% schid3
## (Intercept) Residual
## StdDev: 0.6620245 0.6087328
##
## Fixed effects: math ~ 1
## Value Std.Error DF t-value p-value
## (Intercept) 0.2417616 0.04378032 7998 5.522152 0
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -3.78891050 -0.57684364 -0.05107142 0.52088203 5.13641099
##
## Number of Observations: 10664
## Number of Groups:
## schid3 stid9 %in% schid3
## 75 2666
UnconditionalModel3 <- lmer(math ~ 1 + (1|schid3/stid9), data = Star_k_3)
summary(UnconditionalModel3)
## Linear mixed model fit by REML ['lmerMod']
## Formula: math ~ 1 + (1 | schid3/stid9)
## Data: Star_k_3
##
## REML criterion at convergence: 24496.5
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.7889 -0.5768 -0.0511 0.5211 5.1367
##
## Random effects:
## Groups Name Variance Std.Dev.
## stid9:schid3 (Intercept) 0.4383 0.6620
## schid3 (Intercept) 0.1266 0.3558
## Residual 0.3706 0.6087
## Number of obs: 10664, groups: stid9:schid3, 2666; schid3, 75
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 0.24168 0.04408 5.482
stICC <- .4383/(.4383+.1266+.3706)
schICC <- .1266/(.4383+.1266+.3706)
stICC
## [1] 0.4685195
schICC
## [1] 0.1353287
\(stICC = 0.4685195\)
\(schICC = 0.1353287\)
Level 1: \(math=α_{0jl}+ϵ_{ijl}\)
Level 2: \(α_{0jl}=β_{00l}+β_{01l}Small_{jl}+r_{0jl}\)
Level 3: \(β_{00l}=γ_{000}+u_{0jl}\)
\(β_{01l}=γ_{010}+u_{1jl}\)
The mixed model is:
\(math=γ_{000}+u_{0jl}+γ_{010}Small_{jl}+u_{1jl}Small_{jl}+r_{0jl}+ϵ_{ijl}\)
ThreeLv1 <- lme(math ~ small3, random = list(schid3 = ~ small3,
stid9 = ~ 1), data = Star_k_3)
summary(ThreeLv1)
## Linear mixed-effects model fit by REML
## Data: Star_k_3
## AIC BIC logLik
## 24468.9 24519.82 -12227.45
##
## Random effects:
## Formula: ~small3 | schid3
## Structure: General positive-definite, Log-Cholesky parametrization
## StdDev Corr
## (Intercept) 0.3807361 (Intr)
## small3 0.2328198 -0.318
##
## Formula: ~1 | stid9 %in% schid3
## (Intercept) Residual
## StdDev: 0.6479354 0.6087326
##
## Fixed effects: math ~ small3
## Value Std.Error DF t-value p-value
## (Intercept) 0.1667931 0.04843198 7998 3.443863 6e-04
## small3 0.1732094 0.04060116 2590 4.266121 0e+00
## Correlation:
## (Intr)
## small3 -0.386
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -3.76565464 -0.58225818 -0.05035249 0.52083567 5.16851714
##
## Number of Observations: 10664
## Number of Groups:
## schid3 stid9 %in% schid3
## 75 2666
\(math=.17+.17Small_{jl}\)
\(γ_{000}=.17, t(7998)=3.44, p<.01\), the average intercept across schools is .17 and significant.
\(γ_{010}=.17, t(2590)=4.27, p<.01\), the average “small classes” treatment slope across schools is .17 and significant.
Level 1: \(math=α_{0jl}+ϵ_{ijl}\)
Level 2: \(α_{0jl}=β_{00l}+β_{01l}Small_{jl}+β_{02l}Female_{jl}+r_{0jl}\)
Level 3: \(β_{00l}=γ_{000}+γ_{001}Mfemale_l+u_{00l}\) \(β_{01l}=γ_{010}+γ_{011}Mfemale_l+u_{01j}\) \(β_{02l}=γ_{200}\)
The mixed model is: \(math=γ_{000}+γ_{001}Mfemale_l+u_{00l}+γ_{010}Small_{jl}+γ_{011}Mfemale_lSmall_{jl}+u_{01j}Small_{jl}+γ_{200}Female_{jl}+r_{0jl}+ϵ_{ijl}\)
ThreeLv2 <- lme(math ~ small3 * mfemale3 + female3, random = list(schid3 = ~ small3,
stid9 = ~ 1), data = Star_k_3)
summary(ThreeLv2)
## Linear mixed-effects model fit by REML
## Data: Star_k_3
## AIC BIC logLik
## 24476.99 24549.73 -12228.5
##
## Random effects:
## Formula: ~small3 | schid3
## Structure: General positive-definite, Log-Cholesky parametrization
## StdDev Corr
## (Intercept) 0.3813269 (Intr)
## small3 0.2362412 -0.318
##
## Formula: ~1 | stid9 %in% schid3
## (Intercept) Residual
## StdDev: 0.6480535 0.6087334
##
## Fixed effects: math ~ small3 * mfemale3 + female3
## Value Std.Error DF t-value p-value
## (Intercept) 0.5448111 0.3690616 7998 1.4762064 0.1399
## small3 0.0752273 0.3205280 2588 0.2346981 0.8145
## mfemale3 -0.7891785 0.7660025 73 -1.0302558 0.3063
## female3 -0.0014712 0.0282432 2588 -0.0520902 0.9585
## small3:mfemale3 0.2061869 0.6646698 2588 0.3102095 0.7564
## Correlation:
## (Intr) small3 mfeml3 femal3
## small3 -0.426
## mfemale3 -0.991 0.425
## female3 0.000 -0.001 -0.039
## small3:mfemale3 0.425 -0.992 -0.430 0.002
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -3.76445306 -0.58226936 -0.05024883 0.52082850 5.16845658
##
## Number of Observations: 10664
## Number of Groups:
## schid3 stid9 %in% schid3
## 75 2666
\(math=.545-.789Mfemale_l+.075Small_{jl}+.206Mfemale_lSmall_{jl}-.001Female_{jl}\) \(γ_{000}=.545, t(7998)=1.48, p=.14\), the average intercept across schools is .545 and insignificant.
\(γ_{010}=.075, t(2588)=.23, p=.81\), the average “small classes” treatment slope across schools is .08 and insignificant.
\(γ_{001}=-.789, t(73)=-1.03, p=.31\), the average slope of a school’s proportion of females across schools is -.789 and insignificant.
\(γ_{200}=-.001, t(2588)=-.05, p=.96\), the average slope of students’ gender across schools is -.001 and insignificant.
\(γ_{011}=.206, t(2588)=.31, p=.76\), representing the group math performance difference in the slopes for students who recerived the “small classes” treatment. It is not significantly different from zero. We estimate γ011 to discover whether schools with a larger proportion of female students differ from those schools with a smaller proportion of female students in terms of the strength of association between the “small classes” treatment and math achievement with them after controlling for the variable Female3. With regard to the slopes, there is a tendency for schools with a higher proportion of females to have smaller slopes than do schools with a lower proportion of females.
Level 1: \(math=α_{0jl}+α_{1jl}Grade_{jl}+ϵ_{ijl}\)
Level 2: \(α_{0jl}=β_{00l}+β_{01l}Small_{jl}+r_{0jl}\)
\(α_{1jl}=β_{10l}+β_{11l}Small_{jl}+r_{1jl}\)
Level 3: \(β_{00l}=γ_{000}+u_{00l}\)
\(β_{01l}=γ_{010}+u_{01l}\)
\(β_{10l}=γ_{100}+u_{10l}\)
\(β_{11l}=γ_{110}+u_{11l}\)
The mixed model is:
\(math=γ_{000}+u_{00l}+γ_{010}Small_{jl}+u_{01l}Small_{jl}+r_{0jl}+γ_{100}Grade_{jl}+u_{10l}Grade_{jl}+γ_{110}Small_{jl}Grade_{jl}+u_{11l}Small_{jl}Grade_{jl}+r_{1jl}Grade_{jl}+ϵ_{ijl}\)
ThreeLv3 <- lme(math ~ small3 * grade, random = list(schid3 = ~ small3 * grade,
stid9 = ~ grade), data = Star_k_3)
summary(ThreeLv3)
## Linear mixed-effects model fit by REML
## Data: Star_k_3
## AIC BIC logLik
## 23537.21 23668.14 -11750.6
##
## Random effects:
## Formula: ~small3 * grade | schid3
## Structure: General positive-definite, Log-Cholesky parametrization
## StdDev Corr
## (Intercept) 0.4104136 (Intr) small3 grade
## small3 0.2012855 -0.324
## grade 0.1876553 -0.447 0.327
## small3:grade 0.1135669 0.083 -0.206 -0.534
##
## Formula: ~grade | stid9 %in% schid3
## Structure: General positive-definite, Log-Cholesky parametrization
## StdDev Corr
## (Intercept) 0.6084587 (Intr)
## grade 0.1094575 0.198
## Residual 0.5501535
##
## Fixed effects: math ~ small3 * grade
## Value Std.Error DF t-value p-value
## (Intercept) 0.18252092 0.05204017 7996 3.507309 0.0005
## small3 0.20822542 0.03956778 2590 5.262500 0.0000
## grade -0.01103948 0.02305274 7996 -0.478879 0.6320
## small3:grade -0.02232182 0.01750921 7996 -1.274862 0.2024
## Correlation:
## (Intr) small3 grade
## small3 -0.379
## grade -0.436 0.244
## small3:grade 0.118 -0.286 -0.518
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -3.89184754 -0.56531940 -0.04674924 0.51061394 4.15398008
##
## Number of Observations: 10664
## Number of Groups:
## schid3 stid9 %in% schid3
## 75 2666
\(math=.18+.21Small_{jl}-.01Grade_{jl}-.02Small_{jl}Grade_{jl}\)
\(γ_{000}=.18, t(7996)=3.51, p<.01\), the average intercept across schools is .18 and significant.
\(γ_{010}=.21, t(2590)=5.26, p<.01\), the average “small classes” treatment slope across schools is .21 and significant.
\(γ_{100}=-.01, t(7996)=-.48, p=.63\), the average slope of grade across schools is -.01 and insignificant.
\(γ_{110}=-.02, t(7996)=-1.27, p=.20\), representing the group math performance difference in the slopes for students who recerived the “small classes” treatment. It is not significantly different from zero. We estimate γ110 to discover whether higher grades of a same student differ from lower grades in terms of the strength of association between the “small classes” treatment and math achievement with them. With regard to the slopes, there is a tendency for higher grades to have smaller slopes than do lower grades for the same student.