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

Estimating HLM Models Using SPSS Menus: Part 3

Estimating HLM Models Using SPSS Menus: Part 3


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

Random Coefficient Model

Next, R&B present a model in which student-level SES is included instead of average SES, and they treat the slope of student SES as random. One complication is that R&B present results after group-mean centering student SES. Group-mean centering means that the average SES for each student’s school is subtracted from each student’s individual SES. Unfortunately the meanses variable is coded -1, 0, 1 and is therefore only a rough indicator of each school’s average. To get a better estimate of the school average one can take advantage of the Aggregate command in SPSS.

The first step to group-mean center a variable is to find the average for each cluster. Go to Data → Aggregate


The Aggregate Data menu appears. The variable representing each group is known as a “break” variable; put id in the Break Variable(s) box. The goal is to get the average student SES score from each school, so bring the ses variable over to the Summaries of Variable(s) box. By default, SPSS assumes the user is interested in getting the mean for each group, so there is no need to change the function. Finally, make sure the Add aggregated variables to active datasetradio button is selected.


A new variable ses_mean (not to be confused with the trichotomous meanses) is now added to the data. To complete the group-mean centering, subtract ses_mean from each ses variable. Go to Transform → Compute Variable.


In the menu that appears, create a Target Variable named grp_ses that is equal to ses minus ses_mean.


Click OK. The group-centered SES variable can now be used.

The level-1 equation is the following:


The intercept β0j can be modelled as a grand mean γ00 plus random error, u0j. Similarly the slope β1j can be modelled as having a grand mean γ10 plus random error u1j.


Combining (7) and (8) into (6) produces:


To estimate (9) in SPSS go to Analyze → Mixed Models → Linear. The Specify Subjects and Repeated menu appears again. As before, place id in the Subjects box and leave Repeatedblank.


Click Continue. In the next menu one specifies the dependent and independent variables. The dependent variable is mathach, and the single covariate will be grp_ses.


To specify the model’s fixed effects click on Fixed. In the Fixed Effects menu, bring the grp_ses variable over to the Model box and make sure Include Intercept is checked.


Click Continue, then on Random.

In the Random Effects menu, place the grouping variable id in the Combinations box. Also, because grp_ses will have a random slope it is necessary to place it in the Model box. Next, make sure that Include Intercept is checked so that the intercept is also allowed to vary randomly. Finally, the presence of two random effects means that the dimensions of the covariance matrix G are now 2×2. The default in SPSS is to assume a variance components structure, which implies that there is no covariance between the random intercept and random slope (see the table of covariance structures in A Review of Random Effects ANOVA Models). This assumption can be loosened so that the covariances are free parameters to be estimated from the data. Specify Unstructured for the Covariance Type.


Click Continue. Then click Statistics to specify what appears in the output. Check Parameter Estimates to get results for the fixed effects.


Click Continue, then OK. A portion of the results is the following:


These results correspond to Table 4.4 in R&B. See also the variance-covariance components at the bottom of their page 77.

The final model R&B present is an intercept- and slopes-as-outomes model.

Still have questions? Contact us!