Tutorials › Generalized Linear Mixed Models (GLMM) › Group-Mean Centering and Conditional Effects

Random Intercepts and Slopes · Tutorial 54 of 698

Group-Mean Centering and Conditional Effects

Separate a predictor’s within-cluster and between-cluster associations, and interpret their fixed and random slopes in a GLMM.

Intermediate 9 min read

What You'll Learn

  • Define a group-mean-centered predictor and the corresponding cluster mean.
  • Write a random-slope GLMM that estimates within-cluster and between-cluster associations separately.
  • Interpret fixed and cluster-specific within-cluster slopes on the link scale.
  • Distinguish an individual’s deviation from the cluster mean from the association with that mean.
  • Identify assumptions, diagnostics, and limitations of the within-between decomposition.

Why Separate Within-Cluster and Between-Cluster Associations?

Suppose a health service records a predictor such as weekly exercise for patients treated at several clinics. Two questions are distinct: within a clinic, are patients who exercise more than their clinic’s average different in outcome from their peers? And across clinics, do clinics with higher average exercise have different outcomes? A single predictor coefficient can blur these associations, even when the predictor varies both between patients and between clinics.

Group-mean centering makes the distinction explicit. It does not, by itself, establish a causal effect: patient and clinic characteristics may explain some or all of an observed association. In a GLMM, the two associations are expressed on the model’s link scale; their translation to the response scale depends on the link and the random effects.

Definition: Let \(x_{ij}\) be a predictor for observation \(i\) in cluster \(j\), and let \(\bar{x}_j\) be its mean among the observations in that cluster. The group-mean-centered predictor is \(x_{ij}^{W}=x_{ij}-\bar{x}_j\). It records how far that observation’s predictor is above or below its own cluster mean. The cluster mean \(\bar{x}_j\) records the between-cluster level of the predictor.

For each observation, the decomposition \(x_{ij}=x_{ij}^{W}+\bar{x}_j\) is exact. A positive \(x_{ij}^{W}\) means the observation is above its cluster’s mean; a negative value means it is below. A value of zero means the observation is at the cluster mean. The centered value and the cluster mean answer different questions and should not be treated as interchangeable versions of the same predictor.

A Random-Slope Model With Both Components

Let \(Y_{ij}\) be the response for observation \(i\) in cluster \(j\), and let \(b_{0j}\) and \(b_{1j}\) be that cluster’s random intercept and random slope. A model that separates the two associations is

$$ g\!\left(E[Y_{ij}\mid b_{0j},b_{1j},x_{ij}]\right) = \beta_0+\beta_W(x_{ij}-\bar{x}_j)+\beta_B\bar{x}_j +b_{0j}+b_{1j}(x_{ij}-\bar{x}_j). $$

Here \(g\) is the link function. The fixed coefficient \(\beta_W\) describes the average within-cluster association: the change in the conditional linear predictor for a one-unit increase in \(x_{ij}\) relative to the cluster mean, holding the cluster mean fixed. The fixed coefficient \(\beta_B\) describes the association with a one-unit increase in the cluster mean when the individual’s centered value is zero. The random slope \(b_{1j}\) allows the within-cluster association to vary by cluster. Thus, the cluster-specific within-cluster slope on the link scale is \(\beta_W+b_{1j}\), not \(\beta_W\) alone.

The coefficient \(\beta_B\) is not the random slope. The random slope applies to within-cluster deviations; the cluster mean appears only with its fixed coefficient in this model. The random intercept shifts the conditional linear predictor for a cluster. When comparing the within- and between-cluster coefficients, \(\beta_B-\beta_W\) is sometimes called a contextual contrast: it quantifies how the between-cluster association differs from the within-cluster association on the link scale. It is not automatically a causal contextual effect.

Model assumptions: The response distribution and link must be appropriate for the outcome. Conditional on the covariates and random effects, responses are assumed independent and to follow the specified GLMM response distribution. The random effects are commonly assumed to have mean zero, a joint distribution such as a bivariate normal distribution with an unrestricted covariance matrix, and independence across clusters. The model also assumes the stated linear mean structure on the link scale. Standard random-effects interpretation requires appropriate assumptions about the relationship between covariates and random effects; in particular, unmodeled dependence can bias fixed-effect interpretations. Clusters need enough predictor variation to inform their random slopes.

Why the Decomposition Separates the Associations

The separation follows directly from substituting \(x_{ij}=x_{ij}^{W}+\bar{x}_j\) into a model that allows distinct within- and between-cluster coefficients. The fixed part of the linear predictor is \(\beta_W x_{ij}^{W}+\beta_B\bar{x}_j\). A change in the deviation changes the first term, while a change in the cluster mean changes the second. If instead the model uses one fixed coefficient \(\beta\) for the raw predictor, then

$$ \beta x_{ij}=\beta(x_{ij}^{W}+\bar{x}_j) =\beta x_{ij}^{W}+\beta\bar{x}_j. $$

That raw-predictor specification constrains the within- and between-cluster coefficients to be equal. It therefore cannot represent distinct associations unless the equality is reasonable. Including both components relaxes that constraint and makes the intended comparisons visible in the model.

Worked Example: Interpreting a Clinic-Specific Within-Cluster Slope

Consider a hypothetical Gaussian GLMM for a health score measured in points. The predictor is weekly exercise in hours. Suppose the estimated fixed coefficients are \(\beta_W=1.8\) points per hour and \(\beta_B=0.6\) points per hour. For one clinic, suppose the estimated random slope is \(b_{1j}=-0.5\) points per hour. A patient in that clinic exercises 6 hours per week, while the clinic mean is 4 hours.

The centered predictor is \(x_{ij}^{W}=6-4=2\) hours. The patient’s within-cluster contribution to the conditional linear predictor is \(\beta_W x_{ij}^{W}+b_{1j}x_{ij}^{W}\), so the arithmetic is

$$ 1.8(2)+(-0.5)(2)=3.6-1.0=2.6\text{ points}. $$

For this clinic, the one-hour within-cluster slope is \(\beta_W+b_{1j}=1.8-0.5=1.3\) points per hour. This is the conditional slope for comparing exercise levels within the clinic on the identity-link scale. Separately, the fixed between-cluster association is \(\beta_B=0.6\) points per hour of difference in clinic mean, evaluated at a centered individual value of zero. The contextual contrast is \(\beta_B-\beta_W=0.6-1.8=-1.2\) points per hour. These coefficients describe different comparisons; neither should be substituted for the other.

Worked Example: A Within-Cluster Association on the Logit Scale

In a hypothetical binary-outcome GLMM, suppose the predictor is a weekly exposure measured in units. Let \(\beta_W=-0.40\) per unit and suppose a particular cluster’s random slope is \(b_{1j}=0.15\) per unit. The cluster-specific within-cluster slope is

$$ \beta_W+b_{1j}=-0.40+0.15=-0.25. $$

A one-unit increase in exposure relative to the cluster mean is therefore associated with a \(-0.25\) change in conditional log odds for this cluster, under the model. Exponentiating gives the conditional odds ratio:

$$ \exp(-0.25)\approx 0.7788. $$

Thus, the model associates a one-unit within-cluster increase with odds multiplied by about 0.779, or about 22.1% lower conditional odds, for this cluster. This is not a 22.1% reduction in probability. The fixed between-cluster coefficient \(\beta_B\), which is not supplied here, would describe the association with the cluster mean; it cannot be inferred from this random slope.

Worked Example: Calculating the Components for Two Clusters

Suppose a hypothetical study records a continuous predictor for three observations in each of two clusters. Cluster A has values 2, 4, and 6, so \(\bar{x}_A=(2+4+6)/3=4\). Cluster B has values 5, 7, and 9, so \(\bar{x}_B=(5+7+9)/3=7\). Consider the fixed part of an identity-link model with \(\beta_W=2\) outcome units per predictor unit and \(\beta_B=0.5\) outcome units per predictor unit.

For the observation with \(x=6\) in cluster A, \(x^W=6-4=2\). Its two fixed predictor contributions sum to \(2(2)+0.5(4)=4+2=6\) outcome units, in addition to the fixed intercept. For the observation with \(x=7\) in cluster B, \(x^W=7-7=0\); its contributions sum to \(2(0)+0.5(7)=3.5\) outcome units. The first calculation uses a within-cluster deviation of 2; the second uses the between-cluster mean of 7. These are predictor contributions, not a complete comparison of expected outcomes: random effects and other model terms may also differ between clusters.

Interpretation, Diagnostics, and Alternatives

Interpret each coefficient at the level it represents. The within-cluster association concerns differences among observations in the same cluster, conditional on the model terms. The between-cluster association concerns differences in cluster means. For a log link, exponentiating a slope gives a conditional rate or mean ratio per unit, where appropriate. For a logit link, exponentiating gives a conditional odds ratio. For other links, interpret the coefficient on the link scale or transform the fitted linear predictor using the response function. A coefficient alone does not give a response-scale change that is constant across all baseline values for a nonlinear link.

Several checks help determine whether the decomposition is informative and adequately fitted:

  • Inspect the amount of within-cluster predictor variation. If most clusters have little or no variation, the within-cluster slope and its random variation may be weakly informed.
  • Check the calculation and definition of each cluster mean. Means based on different observation sets or missing-data patterns can change what the between-cluster term represents.
  • Examine convergence, estimated random-effect variances, and the intercept-slope covariance. Convergence problems or a random-slope variance estimated near zero can signal that the requested random-effects structure is not supported well by the data.
  • Assess whether the link-scale mean structure is plausible, including whether a linear within-cluster association is adequate over the observed predictor range. A decomposition does not repair nonlinearity or an inappropriate response distribution.
  • Consider whether cluster means are confounded with unmeasured cluster characteristics. A between-cluster association can reflect those characteristics as well as the predictor mean.

The main alternative is to use the raw predictor with one fixed coefficient, which imposes equality of the within- and between-cluster associations. That simpler constraint may be useful when substantively justified, but it should not be mistaken for an estimated separation. A cluster fixed-effects approach can control for all cluster-constant differences when estimating within-cluster associations, but it does not estimate effects of cluster-constant predictors in the same way. The group-mean-centered model instead includes both the within-cluster deviation and cluster mean, while relying on its random-effects assumptions.

The decomposition is limited by the observed data and model specification. Cluster means can be measured imprecisely when clusters are small; unequal cluster sizes and missing observations affect their precision and interpretation. Neither centering nor a random slope removes confounding, guarantees a causal interpretation, or ensures that the chosen link-scale relationship is correct.

Common Mistake

Pitfall: “The coefficient for \(x_{ij}-\bar{x}_j\) is the effect of the predictor across all observations, so it also describes why high-mean clusters differ from low-mean clusters.” This is incorrect: the centered coefficient describes the within-cluster association, while \(\beta_B\) describes the association with the cluster mean. In a random-slope model, the within-cluster slope for cluster \(j\) is \(\beta_W+b_{1j}\). Both are conditional associations on the link scale, not causal effects without further design and assumptions.

Check Your Understanding

Answer each question, then compare with the brief solutions below.

  1. If \(x_{ij}=12\) and \(\bar{x}_j=9\), what is the group-mean-centered value, and what does its sign mean?
  2. A model estimates \(\beta_W=0.7\) and \(\beta_B=1.1\). What is the contextual contrast, and which association does it compare?
  3. For a cluster, \(\beta_W=-0.3\) and \(b_{1j}=0.1\) in a logit model. Find the cluster-specific within-cluster slope and its conditional odds ratio per unit.
  4. Why does a raw-predictor model with one fixed coefficient not generally separate within- and between-cluster associations?

Solutions. (1) \(12-9=3\), so the observation is 3 predictor units above its cluster mean. (2) \(\beta_B-\beta_W=1.1-0.7=0.4\); it compares the between-cluster mean association with the within-cluster association on the link scale. (3) The slope is \(-0.3+0.1=-0.2\); the odds ratio is \(\exp(-0.2)\approx0.8187\) per unit. (4) Since \(x_{ij}=(x_{ij}-\bar{x}_j)+\bar{x}_j\), one coefficient on \(x_{ij}\) assigns that same coefficient to both components, imposing equality rather than estimating distinct associations.

Clinical Biostats