Mon - Fri : 08:00 AM - 5:00 PM
734.544-8038

Estimating HLM Models Using Stata: Part 2

Estimating HLM Models Using Stata: Part 2

///
Comment0

Note: For a fuller treatment, download our series of lectures Hierarchical Linear Models.

Means-as-Outcomes Model

After estimating the empty model, R&B develop a Means-as-Outcomes model in which a school-level variable, meanses, is added to the model for the intercept. This variable reflects the average student SES level in each school. Recall Equation (1):

hlm16-98

The intercept can be modeled as a grand mean γ00, plus the effect of the average SES score γ01, plus a random error u0j.

hlm19-99

Substituting (4) into (1) yields

hlm20-100

The syntax to estimate this in Stata is the following:


. xtmixed mathach meanses || id:   , var

The dependent variable is listed first after the command followed by the independent variable. No random slopes will be estimated, so the random effects portion of the model only lists the cluster variable. The var option again tells Stata to report random effects as variances rather than standard deviations.

The results are the following:


. xtmixed mathach meanses || id:   , var

Performing EM optimization: 

Performing gradient-based optimization: 

Iteration 0:   log restricted-likelihood = -23480.642  
Iteration 1:   log restricted-likelihood = -23480.642  

Computing standard errors:

Mixed-effects REML regression                   Number of obs      =      7185
Group variable: id                              Number of groups   =       160

                                                Obs per group: min =        14
                                                               avg =      44.9
                                                               max =        67


                                                Wald chi2(1)       =    263.15
Log restricted-likelihood = -23480.642          Prob > chi2        =    0.0000

------------------------------------------------------------------------------
     mathach |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
     meanses |   5.863538   .3614574    16.22   0.000     5.155095    6.571982
       _cons |   12.64944   .1492799    84.74   0.000     12.35685    12.94202
------------------------------------------------------------------------------

------------------------------------------------------------------------------
  Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
id: Identity                 |
                  var(_cons) |   2.638696    .404337      1.954144    3.563051
-----------------------------+------------------------------------------------
               var(Residual) |   39.15709   .6608017      37.88312    40.47389
------------------------------------------------------------------------------
LR test vs. linear regression: chibar2(01) =   239.95 Prob >= chibar2 = 0.0000

This corresponds to Table 4.3 in R&B.

The next step is to estimate a random coefficient model.

Still have questions? Contact us!