Group-Level Predictors

Mark Andrews

Group-level versus observation-level predictors

An observation-level predictor takes a different value for each observation. Pupil SES varies from pupil to pupil.

A group-level predictor takes the same value for every observation in a group. School sector is a property of the school, not of individual pupils.

The MathAchieve data

7,185 pupils in 160 US high schools.

mathach_df2 <- left_join(mathachieve, mathachieveschool, by = "school")
mathach_df2

Pupil-level: ses, mathach, minority, sex. School-level: sector, pracad, himinty, meanses.

Why group-level predictors cannot have random slopes

pracad (proportion on academic track) is a school-level variable: every pupil in a school has the same value.

lmer(mathach ~ pracad + (pracad | school), data = mathach_df2)

A random slope for pracad would require pracad to vary within schools. It does not: each school has a single value. The model is not identified.

Group-level predictor as a fixed effect

Include pracad as a fixed effect with a random intercept for schools.

M_glp <- lmer(mathach ~ pracad + (1 | school), data = mathach_df2)
fixef(M_glp)
VarCorr(M_glp)

The fixed effect of pracad gives the school-level relationship. The random intercept captures residual between-school variation.

Cross-level interactions

Does the effect of pupil SES depend on whether the school has a high proportion of minority students?

Formally: the school-specific slope and intercept for ses depend on the school-level variable himinty.

\[ \begin{aligned} y_i &\sim N(\mu_i, \sigma^2) \\ \mu_i &= \beta_{[s_i]0} + \beta_{[s_i]1} x_i \\ \boldsymbol{\beta}_j &\sim N(\boldsymbol{b}_0 + \boldsymbol{b}_1 z_j, \Sigma) \end{aligned} \]

where \(x_i\) is pupil SES and \(z_j\) is school himinty.

Expanded fixed effects

Expanding the hierarchical model shows the fixed effects structure:

\[ \mu_i = b_{00} + b_{01} z_{[s_i]} + (b_{10} + b_{11} z_{[s_i]}) x_i + \text{random effects} \]

The fixed effects include an intercept, a ses term, a himinty1 term, and a ses:himinty1 interaction term.

Fitting the cross-level interaction

M_glp2 <- lmer(
  mathach ~ ses + himinty + ses:himinty + (ses | school),
  data = mathach_df2
)
fixef(M_glp2)

The ses:himinty1 coefficient tells us how the SES slope differs between high-minority and low-minority schools.

Random effects after adding himinty

VarCorr(M_glp2)

The residual slope variance after accounting for himinty can be compared to the baseline model to assess how much of the school-to-school variation in the SES effect is explained by minority composition.

Confidence intervals

confint(M_glp2, parm = "beta_")

Wide intervals on the interaction term relative to its point estimate suggest limited evidence for a differential SES effect between school types.

Summary

Group-level predictors enter as fixed effects alongside the random intercept. They cannot have random slopes because they do not vary within the group.

A cross-level interaction between a group-level predictor and an observation-level predictor allows the observation-level slope to differ across groups as a function of the group-level variable.