Table 7.1 on page 126 using data set pupcross.
Part 1: Intercept only.
use https://stats.idre.ucla.edu/stat/stata/examples/mlm_ma_hox/pupcross, clear xtmixed achiev || _all: R.sschool||_all: R.pschool, var ml
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log likelihood = -1158.9243 Iteration 1: log likelihood = -1158.9243
Computing standard errors:
Mixed-effects ML regression Number of obs = 1000 Group variable: _all Number of groups = 1
Obs per group: min = 1000 avg = 1000.0 max = 1000
Wald chi2(0) = . Log likelihood = -1158.9243 Prob > chi2 = .
------------------------------------------------------------------------------ achiev | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _cons | 6.348653 .0783121 81.07 0.000 6.195164 6.502142 ------------------------------------------------------------------------------
------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ _all: Identity | var(R.sschool) | .0654012 .0213101 .0345329 .1238622 -----------------------------+------------------------------------------------ _all: Identity | var(R.pschool) | .1693465 .0393136 .1074411 .2669205 -----------------------------+------------------------------------------------ var(Residual) | .5131688 .0239004 .4683993 .5622174 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(2) = 235.17 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
Part 2: intercept plus pupil level variables
xtmixed achiev pupsex pupses || _all: R.sschool||_all: R.pschool, var ml
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log likelihood = -1121.7414 Iteration 1: log likelihood = -1121.7414
Computing standard errors:
Mixed-effects ML regression Number of obs = 1000 Group variable: _all Number of groups = 1
Obs per group: min = 1000 avg = 1000.0 max = 1000
Wald chi2(2) = 77.33 Log likelihood = -1121.7414 Prob > chi2 = 0.0000
------------------------------------------------------------------------------ achiev | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- pupsex | .2613131 .0456365 5.73 0.000 .1718672 .3507591 pupses | .1140858 .0161001 7.09 0.000 .0825302 .1456414 _cons | 5.755482 .1052697 54.67 0.000 5.549157 5.961807 ------------------------------------------------------------------------------
------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ _all: Identity | var(R.sschool) | .0636083 .0205936 .0337235 .1199763 -----------------------------+------------------------------------------------ _all: Identity | var(R.pschool) | .168996 .0387797 .107783 .2649734 -----------------------------+------------------------------------------------ var(Residual) | .4742561 .0220886 .4328804 .5195866 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(2) = 255.60 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
Part 3: primary by secondary School crossed with pupil and school variables
xtmixed achiev pupsex pupses pdenom sdenom || _all: R.sschool||_all: R.pschool, var ml
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log likelihood = -1118.7376 Iteration 1: log likelihood = -1118.7376
Computing standard errors:
Mixed-effects ML regression Number of obs = 1000 Group variable: _all Number of groups = 1
Obs per group: min = 1000 avg = 1000.0 max = 1000
Wald chi2(4) = 83.77 Log likelihood = -1118.7376 Prob > chi2 = 0.0000
------------------------------------------------------------------------------ achiev | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- pupsex | .2630786 .0456102 5.77 0.000 .1736843 .3524729 pupses | .1135645 .0160943 7.06 0.000 .0820203 .1451087 pdenom | .204121 .124103 1.64 0.100 -.0391164 .4473585 sdenom | .1761507 .0946598 1.86 0.063 -.0093792 .3616806 _cons | 5.518506 .1407722 39.20 0.000 5.242597 5.794414 ------------------------------------------------------------------------------
------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ _all: Identity | var(R.sschool) | .0554237 .0185174 .0287941 .1066812 -----------------------------+------------------------------------------------ _all: Identity | var(R.pschool) | .1594093 .0368569 .1013229 .2507952 -----------------------------+------------------------------------------------ var(Residual) | .4741053 .0220801 .4327454 .5194182 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(2) = 236.89 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
Part 4: primary by secondary School crossed with pupil and school variables with variable pupses being modeled as a random effect.
xtmixed achiev pupsex pupses pdenom sdenom || _all: R.sschool || pschool: pupses, var ml cov(un) Performing EM optimization: Performing gradient-based optimization: Iteration 0: log likelihood = -1112.2391 Iteration 1: log likelihood = -1112.2377 Iteration 2: log likelihood = -1112.2377 Computing standard errors: Mixed-effects ML regression Number of obs = 1000 ----------------------------------------------------------- | No. of Observations per Group Group Variable | Groups Minimum Average Maximum ----------------+------------------------------------------ _all | 1 1000 1000.0 1000 pschool | 50 10 20.0 31 ----------------------------------------------------------- Wald chi2(4) = 64.80 Log likelihood = -1112.2377 Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ achiev | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- pupsex | .2531604 .0453024 5.59 0.000 .1643692 .3419515 pupses | .1142274 .020469 5.58 0.000 .0741089 .1543459 pdenom | .1999041 .1176438 1.70 0.089 -.0306735 .4304817 sdenom | .1645517 .0934395 1.76 0.078 -.0185863 .3476897 _cons | 5.532417 .1374673 40.25 0.000 5.262986 5.801848 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ _all: Identity | var(R.sschool) | .0537343 .0180115 .0278569 .1036504 -----------------------------+------------------------------------------------ pschool: Unstructured | var(pupses) | .0080183 .0038835 .0031033 .0207177 var(_cons) | .1485845 .0752156 .0550913 .4007411 cov(pupses,_cons) | -.0156084 .0150028 -.0450135 .0137966 -----------------------------+------------------------------------------------ var(Residual) | .4583576 .0218485 .4174747 .503244 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(4) = 249.89 Prob > chi2 = 0.0000 Note: LR test is conservative and provided only for reference