Tutorials › Generalized Linear Mixed Models (GLMM) › How Centering Changes Random-Intercept and Slope Predictions

Prediction of Random Effects · Tutorial 471 of 698

How Centering Changes Random-Intercept and Slope Predictions

Learn how recentering shifts predicted intercepts while preserving slopes and fitted group deviations at corresponding covariate values.

Advanced 11 min read

What You'll Learn

  • Derive the transformations of fixed and predicted random intercepts and slopes.
  • Interpret a centered random intercept as a group deviation at the centering value.
  • Verify that linear predictors remain unchanged at corresponding covariate values.
  • Transform random-effects covariance when changing the predictor origin.
  • Identify when centering is not merely a reparameterization because the covariance structure is constrained.
  • Diagnose and avoid confusing intercept shifts with changes in group predictions.

Why the Predictor Origin Matters

In a random-intercept and random-slope GLMM, a group’s predicted random intercept is its predicted deviation from the population linear predictor when the predictor equals zero. That interpretation can be awkward if zero is outside the observed range or has no useful meaning. Replacing the predictor with a centered version changes the location at which the intercept is defined. It does not, by itself, change the group’s fitted linear predictor at any observed covariate value.

The key is to transform the intercept and slope together. A slope describes how a group’s linear-predictor deviation changes with the predictor; shifting the predictor’s origin therefore shifts the intercept by an amount determined by that slope. The same algebra applies to the fixed effects. This tutorial derives those transformations, including the corresponding transformation of random-effect uncertainty, and shows when the equivalence can fail.

Model and Centering Transformation

Consider group \(j\), observation \(i\), and a scalar predictor \(x_{ij}\). Write the conditional GLMM as

$$ g\{E(Y_{ij}\mid b_j)\} =\eta_{ij} =\beta_0+\beta_1x_{ij}+b_{0j}+b_{1j}x_{ij}. $$

Here \(g\) is the link function, \(\beta_0,\beta_1\) are fixed effects, and \(b_{0j},b_{1j}\) are the group-specific random-intercept and random-slope deviations. For the standard Gaussian random-effects formulation, assume

$$ \begin{pmatrix}b_{0j}\\b_{1j}\end{pmatrix} \sim N\left( \begin{pmatrix}0\\0\end{pmatrix}, G \right), \qquad G= \begin{pmatrix} \tau_{00}&\tau_{01}\\ \tau_{01}&\tau_{11} \end{pmatrix}, $$

independently across groups, conditional on the model parameters. The response distribution is specified by the chosen GLMM family, and the conditional mean is related to the linear predictor through \(g\). The centering identities below are algebraic and do not depend on whether the response is binary, a count, or another outcome.

Definition: Center \(x\) at a constant \(c\) by defining \(x^c_{ij}=x_{ij}-c\). The same \(c\) must be used for all observations in the model being re-expressed. The new random intercept is the group’s deviation at \(x=c\), while the random slope remains the group’s change in deviation per one-unit increase in \(x\).

Since \(x_{ij}=x^c_{ij}+c\), substitution gives

$$ \begin{aligned} \eta_{ij} &=\beta_0+\beta_1(x^c_{ij}+c)+b_{0j}+b_{1j}(x^c_{ij}+c)\\ &=(\beta_0+c\beta_1)+\beta_1x^c_{ij} +(b_{0j}+cb_{1j})+b_{1j}x^c_{ij}. \end{aligned} $$

Thus the centered parameterization has fixed intercept \(\beta^c_0=\beta_0+c\beta_1\), fixed slope \(\beta^c_1=\beta_1\), random intercept \(b^c_{0j}=b_{0j}+cb_{1j}\), and random slope \(b^c_{1j}=b_{1j}\). These are changes in parameter coordinates, not changes in the fitted linear predictor.

Why the Predictions Transform This Way

The transformation of predicted random effects follows from the same identity, provided the centered model represents the same probability model. More precisely, transform the random-effects distribution along with the coefficients, and use the same response model and data. The likelihood for every possible response pattern is then unchanged because every conditional linear predictor is unchanged. Consequently, the conditional distribution of the random effects given the data is the corresponding transformed distribution.

For example, if \(\hat b_{0j}\) and \(\hat b_{1j}\) are empirical Bayes predictions under the original parameterization, their predictions under the exactly transformed model are

$$ \hat b^c_{0j}=\hat b_{0j}+c\hat b_{1j}, \qquad \hat b^c_{1j}=\hat b_{1j}. $$

This holds for conditional means because expectation is linear. It also holds for conditional modes under a nonsingular linear change of coordinates: the density acquires a constant Jacobian factor, which does not change the location of its mode after that location is transformed. In practice, small numerical discrepancies may arise from optimization tolerances or different fitting procedures.

The random-effects covariance must transform as well. Let \(A=\begin{pmatrix}1&c\\0&1\end{pmatrix}\), so that \(b^c_j=Ab_j\). Then

$$ G^c=AGA^{\mathsf T} = \begin{pmatrix} \tau_{00}+2c\tau_{01}+c^2\tau_{11}&\tau_{01}+c\tau_{11}\\ \tau_{01}+c\tau_{11}&\tau_{11} \end{pmatrix}. $$

The new random intercept can therefore have a different variance and covariance with the slope, even though the group-level fitted values have not changed. This matters for uncertainty calculations and for preserving the same model, not just for translating point predictions.

Worked Example: Re-centering a Group’s Predicted Effects

Suppose a hypothetical group has predicted random effects \(\hat b_{0j}=-0.40\) and \(\hat b_{1j}=0.08\) per unit of \(x\). Center at \(c=10\). Find the centered predictions and compare the group deviations at \(x=8\).

The transformed intercept prediction is

$$ \hat b^c_{0j}=\hat b_{0j}+c\hat b_{1j} =-0.40+10(0.08)=0.40. $$

The slope prediction does not change: \(\hat b^c_{1j}=0.08\) per unit. At the original value \(x=8\), the group’s deviation from the population linear predictor is

$$ \hat b_{0j}+\hat b_{1j}x =-0.40+0.08(8)=0.24. $$

The centered value is \(x^c=8-10=-2\), giving

$$ \hat b^c_{0j}+\hat b^c_{1j}x^c =0.40+0.08(-2)=0.24. $$

Both parameterizations give a group deviation of \(0.24\) on the linear-predictor scale at \(x=8\). The centered intercept \(0.40\) is the predicted deviation at \(x=10\), not at \(x=0\).

Fixed Effects and Full Fitted Values

The fixed effects shift in the same way as the random effects. Comparing only predicted random effects is not enough to verify that the model’s fitted values are unchanged: the fixed intercept must also be transformed. At any original covariate value \(x\), the group-specific linear predictor can be written as

$$ \eta_j(x) =(\beta_0+b_{0j})+(\beta_1+b_{1j})x. $$

After centering, the group-specific intercept is \(\beta^c_0+b^c_{0j}\), and the group-specific slope is \(\beta^c_1+b^c_{1j}\). Substitution of the transformations gives

$$ (\beta^c_0+b^c_{0j})+(\beta^c_1+b^c_{1j})(x-c) =(\beta_0+b_{0j})+(\beta_1+b_{1j})x. $$

Applying the inverse link to equal linear predictors gives equal conditional fitted means at corresponding covariate values. This does not say that a coefficient is unchanged in interpretation: the intercept’s reference value has moved. Nor does it say that differences on the response scale are generally equal to differences on the linear-predictor scale.

Worked Example: Checking the Complete Linear Predictor

In a hypothetical logistic random-slope model, suppose \(\beta_0=1.20\), \(\beta_1=0.30\) per unit, and a group has predicted effects \(\hat b_{0j}=-0.50\), \(\hat b_{1j}=0.10\) per unit. Center \(x\) at \(c=5\), and check the linear predictor at \(x=2\).

The centered fixed effects are \(\beta^c_0=1.20+5(0.30)=2.70\) and \(\beta^c_1=0.30\). The centered random-effect predictions are \(\hat b^c_{0j}=-0.50+5(0.10)=0.00\) and \(\hat b^c_{1j}=0.10\). In the original parameterization, at \(x=2\),

$$ \hat\eta_j(2)=1.20+0.30(2)-0.50+0.10(2) =1.20+0.60-0.50+0.20=1.50. $$

In the centered parameterization, \(x^c=2-5=-3\), so

$$ \hat\eta^c_j(-3) =2.70+0.30(-3)+0.00+0.10(-3) =2.70-0.90-0.30=1.50. $$

For the logistic link, both parameterizations therefore give the same conditional fitted probability, \(\operatorname{logit}^{-1}(1.50)=1/(1+\exp(-1.50))\approx0.8176\). The equality concerns the fitted probability at the same original covariate value, \(x=2\).

Uncertainty and Model Equivalence

The covariance transformation is the uncertainty counterpart of the prediction transformation. For instance, suppose a hypothetical fitted random-effects covariance matrix has \(\tau_{00}=0.36\), \(\tau_{01}=0.03\), and \(\tau_{11}=0.01\), with the intercept measured on the linear-predictor scale and the slope per unit of \(x\). Center at \(c=4\). Then

$$ \begin{aligned} \operatorname{Var}(b^c_{0j}) &=0.36+2(4)(0.03)+4^2(0.01)=0.76,\\ \operatorname{Cov}(b^c_{0j},b^c_{1j}) &=0.03+4(0.01)=0.07,\\ \operatorname{Var}(b^c_{1j})&=0.01. \end{aligned} $$

If the original point predictions were \(\hat b_{0j}=-0.20\) and \(\hat b_{1j}=0.05\), then the centered intercept prediction is \(-0.20+4(0.05)=0.00\), and the slope prediction remains \(0.05\). A different variance for the intercept prediction’s underlying random effect is not a contradiction: it describes variation in group deviations at a different predictor value.

Exact equivalence requires allowing the transformed covariance structure. If a model constrains the random intercept and slope to be independent, it sets their covariance to zero in the chosen parameterization. After centering, the transformed covariance is generally not zero, since \(\tau^c_{01}=\tau_{01}+c\tau_{11}\). Fitting an independent-effects model both before and after centering can therefore impose different restrictions and yield different predictions. The same warning applies to other constraints that are not preserved by the transformation.

Worked Example: Checking Whether a Covariance Constraint Is Preserved

Suppose a hypothetical model has independent random intercept and slope effects, with \(\tau_{01}=0\) and \(\tau_{11}=0.04\). Center the predictor at \(c=3\). Does independence remain true in the centered parameterization?

The transformed covariance is

$$ \tau^c_{01}=\tau_{01}+c\tau_{11} =0+3(0.04)=0.12. $$

Thus the transformed intercept and slope are not independent under this covariance matrix. If the centered model is forced to have zero covariance, it cannot represent the same random-effects distribution (unless another relevant quantity, such as the slope variance, is zero or the centering value happens to preserve the constraint). A difference between predictions from these separately constrained fits is not evidence that centering changed the same model; the fits used different covariance assumptions.

Diagnostics, Alternatives, and Limitations

A useful check is to calculate the original and centered linear predictors for several values of \(x\), using the transformed fixed and random effects. They should agree to numerical precision. If they do not, check that the same \(c\) was used throughout, that the slope was not inadvertently changed, and that both fixed and random intercepts were transformed. Also verify that the fitted models use equivalent random-effects covariance structures.

Centering is particularly useful when zero is not a meaningful or well-supported predictor value. One can center at a scientifically meaningful reference value or, often, at a sample mean. Centering at the mean makes the intercept refer to that mean, but it does not guarantee improved model fit or remove uncertainty in the random effects. A separate alternative is to retain the original predictor and report group-specific predicted deviations at a chosen value \(x=c\), calculated as \(\hat b_{0j}+c\hat b_{1j}\). That gives the same quantity without changing the fitted model’s parameterization.

Centering a single predictor by a fixed constant does not alter its unit or the random-slope meaning. Rescaling the predictor is a different transformation and also changes the numerical slope. For multiple predictors or interactions, every affected term must be re-expressed consistently; shifting one predictor while leaving associated terms untransformed may alter the model. Finally, predictions remain estimates, with uncertainty from the data and fitted parameters. Algebraic invariance does not make those predictions known without error.

Common Pitfalls

  • Changing the intercept but not the slope contribution. The correct centered intercept is \(\hat b_{0j}+c\hat b_{1j}\), not \(\hat b_{0j}\) alone.
  • Transforming random effects but not fixed effects. This fails to preserve the complete group-specific linear predictor. Transform both intercepts using their corresponding slopes.
  • Calling the new intercept the group’s deviation at zero. It is the deviation at original \(x=c\), because centered zero corresponds to original \(x=c\).
  • Assuming every refitted model must give identical results. This is true for equivalent parameterizations, not necessarily when covariance restrictions are imposed separately after centering.
  • Claiming that centering changes the group’s predictions. With a consistent transformation, the linear predictor and conditional mean at each corresponding covariate value are unchanged; only the coordinates and coefficient interpretations change.
Key takeaway: Under \(x^c=x-c\), transform each predicted random intercept by \(\hat b^c_{0j}=\hat b_{0j}+c\hat b_{1j}\), leave the random slope unchanged, and transform the fixed effects and covariance consistently. Then fitted group deviations at corresponding covariate values are preserved.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. A group has \(\hat b_{0j}=0.30\) and \(\hat b_{1j}=-0.04\) per unit. Center at \(c=5\). What are the centered predictions?
  2. Using the predictions in question 1, calculate the group deviation at original \(x=8\) in both parameterizations.
  3. If \(\beta_0=0.80\), \(\beta_1=0.20\), and \(c=4\), what is the centered fixed intercept? State its reference value.
  4. If \(\tau_{01}=0.02\), \(\tau_{11}=0.03\), and \(c=2\), find the transformed intercept-slope covariance.
  5. Why might separately fitted models with independent random intercepts and slopes differ after centering?

Solutions. (1) \(\hat b^c_{0j}=0.30+5(-0.04)=0.10\), and \(\hat b^c_{1j}=-0.04\) per unit. (2) Originally, \(0.30-0.04(8)=-0.02\). Centered \(x^c=8-5=3\), giving \(0.10-0.04(3)=-0.02\). (3) \(\beta^c_0=0.80+4(0.20)=1.60\); it is the fixed linear-predictor intercept at original \(x=4\). (4) \(\tau^c_{01}=\tau_{01}+c\tau_{11}=0.02+2(0.03)=0.08\). (5) Independence sets the intercept-slope covariance to zero, but centering generally transforms it to \(\tau_{01}+c\tau_{11}\), which need not be zero. The two constrained fits may therefore represent different models.

Clinical Biostats