use https://stats.idre.ucla.edu/stat/examples/imm/imm23, clear
describe
Contains data from imm23.dta
obs: 519
vars: 18 19 Mar 2002 10:39
size: 39,444 (99.8% of memory free)
-------------------------------------------------------------------------------
storage display value
variable name type format label variable label
-------------------------------------------------------------------------------
schid float %9.0g School ID
stuid float %9.0g Student ID
ses float %9.0g Socioecnonomic Status
meanses float %9.0g Mean SES for the school
homework float %9.0g Time spent on math homework
each week
white float %9.0g Race: 1=white, 0=non-white
parented float %9.0g Parents highest education level
public float %9.0g Public school: 1=public,
0=non-public
ratio float %9.0g Student-Teacher ratio
percmin float %9.0g Percent minority in school
math float %9.0g Math score
sex float %9.0g Sex: 1=male, 2=female
race float %9.0g race of student, 1=asian,
2=Hispanic, 3=Black, 4=White,
5=Native American
sctype float %9.0g Type of school, 1=public,
2=catholic, 3=Private other
religious, 4=Private non-r
cstr float %9.0g
scsize float %9.0g
urban float %9.0g
region float %9.0g
-------------------------------------------------------------------------------
Sorted by: schid stuid
Page 64, 4.2.2, The Null Model, Model 0.
xtmixed math || schid:, variance
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1899.3393
Iteration 1: log restricted-likelihood = -1899.3393
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(0) = .
Log restricted-likelihood = -1899.3393 Prob > chi2 = .
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_cons | 50.75885 1.151181 44.09 0.000 48.50258 53.01513
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Identity |
var(_cons) | 26.12419 8.987209 13.31109 51.27103
-----------------------------+------------------------------------------------
var(Residual) | 81.24387 5.153894 71.74516 92.00015
------------------------------------------------------------------------------
LR test vs. linear regression: chibar2(01) = 134.06 Prob >= chibar2 = 0.0000
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1899.339 3 3804.679 3817.434
------------------------------------------------------------------------------
Page 65, 4.2.3 ‘Homework and ‘MathAchievement’, Model 1.
xtmixed math homework || schid:, variance
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1864.6598
Iteration 1: log restricted-likelihood = -1864.6598
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(1) = 74.95
Log restricted-likelihood = -1864.6598 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 2.399867 .2771976 8.66 0.000 1.856569 2.943164
_cons | 46.35575 1.162776 39.87 0.000 44.07676 48.63475
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Identity |
var(_cons) | 21.34157 7.574593 10.64428 42.78943
-----------------------------+------------------------------------------------
var(Residual) | 71.28374 4.530462 62.93498 80.74002
------------------------------------------------------------------------------
LR test vs. linear regression: chibar2(01) = 96.43 Prob >= chibar2 = 0.0000
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1864.66 4 3737.32 3754.327
------------------------------------------------------------------------------
Pages 66 and 67, 4.2.4 Random slope for ‘Homework’, model 2.
xtmixed math homework || schid: homework, variance covar(un)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1817.781
Iteration 1: log restricted-likelihood = -1817.781
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(1) = 4.55
Log restricted-likelihood = -1817.781 Prob > chi2 = 0.0329
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 1.980164 .9284474 2.13 0.033 .1604405 3.799888
_cons | 46.32561 1.758932 26.34 0.000 42.87816 49.77305
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Unstructured |
var(homework) | 17.72647 6.260262 8.871821 35.41863
var(_cons) | 62.42438 21.38146 31.90087 122.1535
cov(homework,_cons) | -27.59383 10.56622 -48.30324 -6.884415
-----------------------------+------------------------------------------------
var(Residual) | 53.29463 3.465963 46.91659 60.53973
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(3) = 190.19 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1817.781 6 3647.562 3673.074
------------------------------------------------------------------------------
Page 69, 4.2.5 Adding ‘ParentEducation’, model 3.
xtmixed math homework parented || schid: homework, variance covar(un)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1800.0217
Iteration 1: log restricted-likelihood = -1800.0217
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(2) = 44.61
Log restricted-likelihood = -1800.0217 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 1.881702 .830247 2.27 0.023 .2544478 3.508956
parented | 1.841414 .2959197 6.22 0.000 1.261422 2.421406
_cons | 40.85465 1.790225 22.82 0.000 37.34588 44.36343
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Unstructured |
var(homework) | 13.8786 5.039229 6.812086 28.27557
var(_cons) | 47.86951 17.01638 23.84947 96.08136
cov(homework,_cons) | -21.95137 8.502263 -38.6155 -5.287237
-----------------------------+------------------------------------------------
var(Residual) | 50.77825 3.311781 44.68502 57.70234
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(3) = 119.94 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1800.022 7 3614.043 3643.807
------------------------------------------------------------------------------
Page 70 and 71, 4.2.6 Traditional regression model.
xtmixed math homework parented , variance
Mixed-effects REML regression Number of obs = 519
Wald chi2(2) = 264.49
Log restricted-likelihood = -1859.9932 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 2.335361 .2683967 8.70 0.000 1.809313 2.861409
parented | 3.003987 .2765059 10.86 0.000 2.462046 3.545929
_cons | 37.23915 .9962789 37.38 0.000 35.28648 39.19182
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
var(Residual) | 76.11628 4.725077 67.39652 85.96421
------------------------------------------------------------------------------
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1859.993 4 3727.986 3744.994
------------------------------------------------------------------------------
/* using the regress command */
regress math homework parented
Source | SS df MS Number of obs = 519
-------------+------------------------------ F( 2, 516) = 132.25
Model | 20132.0446 2 10066.0223 Prob > F = 0.0000
Residual | 39276.0016 516 76.1162822 R-squared = 0.3389
-------------+------------------------------ Adj R-squared = 0.3363
Total | 59408.0462 518 114.687348 Root MSE = 8.7245
------------------------------------------------------------------------------
math | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 2.335361 .2683967 8.70 0.000 1.808077 2.862646
parented | 3.003987 .2765059 10.86 0.000 2.460771 3.547203
_cons | 37.23915 .9962789 37.38 0.000 35.28189 39.19641
------------------------------------------------------------------------------
Page 73/74, 4.3.2 A model with ‘SchoolSize’ (Model 2).
xtmixed math homework scsize || schid: homework, variance covar(un)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1817.1153
Iteration 1: log restricted-likelihood = -1817.1153
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(2) = 5.02
Log restricted-likelihood = -1817.1153 Prob > chi2 = 0.0812
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 1.981179 .9298449 2.13 0.033 .1587166 3.803642
scsize | .4259322 .6409595 0.66 0.506 -.8303253 1.68219
_cons | 44.97198 2.710876 16.59 0.000 39.65876 50.2852
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Unstructured |
var(homework) | 17.78479 6.281797 8.900087 35.53883
var(_cons) | 66.42771 23.33067 33.37269 132.2231
cov(homework,_cons) | -28.75128 11.07166 -50.45133 -7.051229
-----------------------------+------------------------------------------------
var(Residual) | 53.3058 3.467273 46.92541 60.55372
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(3) = 189.33 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1817.115 7 3648.231 3677.994
------------------------------------------------------------------------------
Page 74/75, 4.3.3 Changing ‘SchoolSize’ to ‘Public’ (Model 3).
xtmixed math homework public || schid: homework, variance covar(un)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1814.194
Iteration 1: log restricted-likelihood = -1814.194
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(2) = 8.92
Log restricted-likelihood = -1814.194 Prob > chi2 = 0.0116
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 1.97527 .9184314 2.15 0.031 .1751778 3.775363
public | -4.060999 1.977904 -2.05 0.040 -7.93762 -.1843776
_cons | 49.05035 2.184881 22.45 0.000 44.76807 53.33264
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Unstructured |
var(homework) | 17.31097 6.113316 8.664078 34.58762
var(_cons) | 60.17005 20.89702 30.46202 118.8508
cov(homework,_cons) | -27.45916 10.38128 -47.8061 -7.112219
-----------------------------+------------------------------------------------
var(Residual) | 53.34333 3.471559 46.95527 60.60046
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(3) = 157.64 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1814.194 7 3642.388 3672.151
------------------------------------------------------------------------------
Page 77, 4.3.4 Adding a cross level interaction with ‘Public’, (Model 4).
generate homewrkXpublic = homework*public
xtmixed math homework public homewrkXpublic || schid: homework, variance covar(un)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1812.5753
Iteration 1: log restricted-likelihood = -1812.5753
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(3) = 8.72
Log restricted-likelihood = -1812.5753 Prob > chi2 = 0.0333
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 2.292791 1.591376 1.44 0.150 -.8262482 5.411831
public | -3.261944 3.714642 -0.88 0.380 -10.54251 4.018621
homewrkXpu~c | -.4956655 1.972783 -0.25 0.802 -4.362249 3.370918
_cons | 48.52887 3.016064 16.09 0.000 42.6175 54.44025
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Unstructured |
var(homework) | 18.25189 6.551994 9.031228 36.88663
var(_cons) | 62.55576 22.05624 31.3434 124.85
cov(homework,_cons) | -28.95327 11.08199 -50.67357 -7.232962
-----------------------------+------------------------------------------------
var(Residual) | 53.33265 3.470174 46.94705 60.58679
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(3) = 159.63 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1812.575 8 3641.151 3675.166
------------------------------------------------------------------------------
Page 80, 4.3.5 Model 4 will full NELS-88 data (we don’t have these data, so this is omitted).
Page 80/82, 4.3.6 Deleting ‘HomePublic’ and adding ‘White’ (Model 5).
xtmixed math homework public white || schid: homework, variance covar(un)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1807.7266
Iteration 1: log restricted-likelihood = -1807.7266
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(3) = 21.73
Log restricted-likelihood = -1807.7266 Prob > chi2 = 0.0001
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 1.899176 .9050575 2.10 0.036 .125296 3.673056
public | -3.882385 1.798686 -2.16 0.031 -7.407744 -.3570262
white | 3.309409 .9698517 3.41 0.001 1.408534 5.210283
_cons | 46.62829 2.192207 21.27 0.000 42.33164 50.92493
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Unstructured |
var(homework) | 16.77652 5.931869 8.389431 33.54834
var(_cons) | 56.03024 19.63033 28.19694 111.3379
cov(homework,_cons) | -26.81495 10.00251 -46.41951 -7.210387
-----------------------------+------------------------------------------------
var(Residual) | 52.72817 3.436984 46.40436 59.91377
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(3) = 133.03 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1807.727 8 3631.453 3665.468
------------------------------------------------------------------------------
Page 82/83, 4.3.7 Adding a random part for ‘White’ (Model 6).
xtmixed math homework public white || schid: homework white, variance covar(un)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1805.255
Iteration 1: log restricted-likelihood = -1805.2505
Iteration 2: log restricted-likelihood = -1805.2505
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(3) = 15.98
Log restricted-likelihood = -1805.2505 Prob > chi2 = 0.0011
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 1.940045 .9004501 2.15 0.031 .1751951 3.704894
public | -4.929207 1.650688 -2.99 0.003 -8.164497 -1.693917
white | 2.598035 1.553804 1.67 0.095 -.4473641 5.643434
_cons | 48.22768 2.340021 20.61 0.000 43.64132 52.81403
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Unstructured |
var(homework) | 16.63131 5.874699 8.322529 33.23514
var(white) | 26.50044 22.54574 5.001239 140.4199
var(_cons) | 69.16463 31.24256 28.53549 167.642
cov(homework,white) | 2.923541 7.944215 -12.64683 18.49392
cov(homework,_cons) | -28.54352 12.26504 -52.58255 -4.504491
cov(white,_cons) | -22.08364 20.96947 -63.18305 19.01577
-----------------------------+------------------------------------------------
var(Residual) | 51.15698 3.384706 44.9352 58.24023
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(6) = 137.98 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1805.251 11 3632.501 3679.272
------------------------------------------------------------------------------
Page 85, 4.3.8 Making the coefficient of ‘White’ fixed and adding ‘MeanSES’ (Model 7).
xtmixed math homework public white meanses || schid: homework, variance covar(un)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1803.2599
Iteration 1: log restricted-likelihood = -1803.2599
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(4) = 31.50
Log restricted-likelihood = -1803.2599 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 1.924179 .8964219 2.15 0.032 .1672248 3.681134
public | .1604258 2.270945 0.07 0.944 -4.290545 4.611396
white | 3.096913 .9630887 3.22 0.001 1.209294 4.984532
meanses | 4.977274 1.950878 2.55 0.011 1.153624 8.800924
_cons | 44.61584 2.235094 19.96 0.000 40.23513 48.99654
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Unstructured |
var(homework) | 16.44364 5.821773 8.21552 32.91249
var(_cons) | 54.13689 19.09921 27.11402 108.0918
cov(homework,_cons) | -27.0358 9.902771 -46.44487 -7.626721
-----------------------------+------------------------------------------------
var(Residual) | 52.79435 3.444721 46.45669 59.99659
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(3) = 109.59 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1803.26 9 3624.52 3662.787
------------------------------------------------------------------------------
Page 86, 4.3.9 Deleting the school characteristic ‘Public’ (Model 8).
xtmixed math homework white meanses || schid: homework, variance covar(un)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1804.9907
Iteration 1: log restricted-likelihood = -1804.9907
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(3) = 32.52
Log restricted-likelihood = -1804.9907 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 1.925085 .8951596 2.15 0.032 .1706048 3.679566
white | 3.114922 .9570099 3.25 0.001 1.239217 4.990627
meanses | 4.892483 1.340592 3.65 0.000 2.264971 7.519995
_cons | 44.7022 1.787226 25.01 0.000 41.1993 48.2051
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Unstructured |
var(homework) | 16.39899 5.804124 8.195013 32.8159
var(_cons) | 53.57389 18.91041 26.8224 107.0061
cov(homework,_cons) | -26.99907 9.864397 -46.33293 -7.665203
-----------------------------+------------------------------------------------
var(Residual) | 52.79042 3.444296 46.45353 59.99175
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(3) = 108.55 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1804.991 8 3625.981 3659.997
------------------------------------------------------------------------------
Page 87/88, 4.3.10 Adding an interaction between ‘HomeWork’ and ‘MeanSES’ (Model 9).
generate homewrkXmeanses = homework*meanses
xtmixed math homework white meanses homewrkXmeanses || schid: homework, variance covar(un)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1803.5271
Iteration 1: log restricted-likelihood = -1803.5271
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(4) = 32.31
Log restricted-likelihood = -1803.5271 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 1.974678 .9291318 2.13 0.034 .1536126 3.795742
white | 3.115026 .9571186 3.25 0.001 1.239108 4.990944
meanses | 3.977613 3.022684 1.32 0.188 -1.946739 9.901965
homewrkXme~s | .5530935 1.64573 0.34 0.737 -2.672479 3.778666
_cons | 44.61137 1.836096 24.30 0.000 41.01268 48.21005
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Unstructured |
var(homework) | 17.23849 6.210693 8.508005 34.92775
var(_cons) | 55.88547 20.01922 27.6938 112.7756
cov(homework,_cons) | -28.38963 10.52383 -49.01596 -7.763291
-----------------------------+------------------------------------------------
var(Residual) | 52.78088 3.443055 46.4462 59.97952
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(3) = 111.28 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1803.527 9 3625.054 3663.321
------------------------------------------------------------------------------
Page 88/89, 4.3.11 Adding another student-level variable (Model 10).
xtmixed math homework white meanses ses || schid: homework, variance covar(un)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1796.3777
Iteration 1: log restricted-likelihood = -1796.3777
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(4) = 50.25
Log restricted-likelihood = -1796.3777 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 1.825613 .8504767 2.15 0.032 .1587094 3.492517
white | 2.170787 .9732755 2.23 0.026 .2632017 4.078372
meanses | 2.945142 1.428078 2.06 0.039 .1461609 5.744123
ses | 2.205733 .5356316 4.12 0.000 1.155914 3.255551
_cons | 45.67481 1.752034 26.07 0.000 42.24089 49.10874
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Unstructured |
var(homework) | 14.64975 5.247581 7.259843 29.56194
var(_cons) | 49.89752 17.73365 24.86341 100.1376
cov(homework,_cons) | -24.37951 9.046941 -42.11119 -6.647832
-----------------------------+------------------------------------------------
var(Residual) | 51.29601 3.350503 45.13211 58.30175
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(3) = 103.65 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1796.378 9 3610.755 3649.023
------------------------------------------------------------------------------
Page 88/89, 4.3.12: Analyses with NELS-88 (we don’t have these data, so these analyses are omitted).
Page 91, 4.4.1 ‘SES’ as a student-level explanatory variable (Model 1).
xtmixed math ses || schid:, variance
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1873.0887
Iteration 1: log restricted-likelihood = -1873.0887
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(1) = 58.53
Log restricted-likelihood = -1873.0887 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
ses | 4.332311 .5662715 7.65 0.000 3.222439 5.442182
_cons | 51.20085 .8507325 60.18 0.000 49.53345 52.86826
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Identity |
var(_cons) | 12.6317 5.015357 5.800912 27.506
-----------------------------+------------------------------------------------
var(Residual) | 75.32781 4.78723 66.50585 85.32001
------------------------------------------------------------------------------
LR test vs. linear regression: chibar2(01) = 43.58 Prob >= chibar2 = 0.0000
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1873.089 4 3754.177 3771.185
------------------------------------------------------------------------------
Page 92, 4.4.2 Adding a random slope (Model 2). Model never converged.
set maxiter 100
xtmixed math ses || schid: ses, variance covar(un)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1873.3707
Iteration 1: log restricted-likelihood = -1873.0375
[output omitted]
Iteration 99: log restricted-likelihood = -1872.9972 (not concave)
Iteration 100: log restricted-likelihood = -1872.9972 (not concave)
convergence not achieved
Computing standard errors:
standard error calculation failed
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(1) = 58.02
Log restricted-likelihood = -1872.9972 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
ses | 4.32386 .5676435 7.62 0.000 3.211299 5.436421
_cons | 51.24839 .8562642 59.85 0.000 49.57015 52.92664
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Unstructured |
var(ses) | .0962659 . . .
var(_cons) | 12.89715 . . .
cov(ses,_cons) | -1.114251 . . .
-----------------------------+------------------------------------------------
var(Residual) | 75.19665 . . .
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(3) = 43.77 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1872.997 2 3749.994 3758.498
------------------------------------------------------------------------------
Page 93, 4.4.3 Adding ‘PercentMinorities’ (Model 3), SAS Program.
xtmixed math ses percmin || schid:, variance
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1870.8054
Iteration 1: log restricted-likelihood = -1870.8054
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(2) = 66.23
Log restricted-likelihood = -1870.8054 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
ses | 4.298805 .5618229 7.65 0.000 3.197652 5.399958
percmin | -.8093957 .3647249 -2.22 0.026 -1.524243 -.094548
_cons | 53.12666 1.178066 45.10 0.000 50.81769 55.43562
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Identity |
var(_cons) | 10.69835 4.337275 4.833108 23.68137
-----------------------------+------------------------------------------------
var(Residual) | 75.17249 4.769303 66.38266 85.1262
------------------------------------------------------------------------------
LR test vs. linear regression: chibar2(01) = 40.65 Prob >= chibar2 = 0.0000
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1870.805 5 3751.611 3772.87
------------------------------------------------------------------------------
Page 95, 4.4.4 Adding ‘MeanSES’ (Model 4).
xtmixed math ses percmin meanses || schid:, variance
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1867.8075
Iteration 1: log restricted-likelihood = -1867.8075
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(3) = 73.80
Log restricted-likelihood = -1867.8075 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
ses | 3.88476 .6097731 6.37 0.000 2.689627 5.079894
percmin | -.6921886 .3456913 -2.00 0.045 -1.369731 -.014646
meanses | 2.805075 1.479369 1.90 0.058 -.0944343 5.704584
_cons | 53.0969 1.102666 48.15 0.000 50.93572 55.25809
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Identity |
var(_cons) | 8.846737 3.936787 3.698277 21.16249
-----------------------------+------------------------------------------------
var(Residual) | 75.24051 4.777618 66.4358 85.2121
------------------------------------------------------------------------------
LR test vs. linear regression: chibar2(01) = 25.48 Prob >= chibar2 = 0.0000
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1867.808 6 3747.615 3773.126
------------------------------------------------------------------------------
Page 95, 4.4.5 Analyses with NELS-88, models 2 and 3 (we do not have these data, so these analyses are omitted).
Page 99, 4.5.1 Analysis with class size and a cross level interaction (Model 1).
xtmixed math homework ratio || schid: homework, variance covar(un)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1818.3188
Iteration 1: log restricted-likelihood = -1818.3188
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(2) = 4.74
Log restricted-likelihood = -1818.3188 Prob > chi2 = 0.0934
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 1.979276 .9288626 2.13 0.033 .1587383 3.799813
ratio | -.0944215 .2123894 -0.44 0.657 -.510697 .3218541
_cons | 47.9616 4.083297 11.75 0.000 39.95848 55.96471
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Unstructured |
var(homework) | 17.74195 6.268408 8.876944 35.46005
var(_cons) | 63.48001 21.7818 32.40153 124.368
cov(homework,_cons) | -27.70352 10.64132 -48.56012 -6.846919
-----------------------------+------------------------------------------------
var(Residual) | 53.30429 3.467218 46.92401 60.5521
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(3) = 183.07 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1818.319 7 3650.638 3680.401
------------------------------------------------------------------------------
Page 100, 4.5.2 Interaction between ‘Ratio’ and ‘HomeWork’ (Model 2), SAS Program.
generate homewrkXratio = homework*ratio
xtmixed math homework homewrkXratio || schid: homework, variance covar(un)
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1818.9455
Iteration 1: log restricted-likelihood = -1818.9455
Computing standard errors:
Mixed-effects REML regression Number of obs = 519
Group variable: schid Number of groups = 23
Obs per group: min = 5
avg = 22.6
max = 67
Wald chi2(2) = 4.66
Log restricted-likelihood = -1818.9455 Prob > chi2 = 0.0974
------------------------------------------------------------------------------
math | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
homework | 2.884085 2.156817 1.34 0.181 -1.3432 7.111369
homewrkXra~o | -.0525855 .1122818 -0.47 0.640 -.2726539 .1674828
_cons | 46.33064 1.760591 26.32 0.000 42.87995 49.78134
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
schid: Unstructured |
var(homework) | 18.09523 6.390325 9.056545 36.15477
var(_cons) | 62.55502 21.42087 31.97298 122.3887
cov(homework,_cons) | -27.80043 10.65508 -48.68401 -6.916853
-----------------------------+------------------------------------------------
var(Residual) | 53.29771 3.46642 46.91886 60.5438
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(3) = 180.57 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
estat ic
------------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+----------------------------------------------------------------
| 519 . -1818.945 7 3651.891 3681.654
------------------------------------------------------------------------------
Page 100, 4.5.3 Reporting the modeling session with NELS-88 (we do not have these data, so these analyses are omitted).
