Tutorials › Generalized Linear Mixed Models (GLMM) › Defining the Target of Random-Effect Prediction

Prediction of Random Effects · Tutorial 449 of 698

Defining the Target of Random-Effect Prediction

Learn to define the prediction target before calculating or interpreting a GLMM prediction.

Advanced 10 min read

What You'll Learn

  • Define an observed-group latent-effect target using that group’s data.
  • Define a new-group effect target using the random-effects population distribution.
  • Distinguish both latent-effect targets from prediction of a response.
  • Interpret conditional and integrated response predictions correctly.
  • Identify which sources of uncertainty a prediction includes.
  • Recognize common target mismatches and assumptions that can undermine interpretation.

Why the Target Must Come First

A GLMM can produce several different predictions from the same fitted model. One may concern the latent effect of a group already represented in the data, the effect of a group not yet observed, or an outcome for a particular unit. These are not interchangeable quantities: they refer to different random variables and use different information. Before interpreting a prediction, specify what is being predicted, for which group or unit, and conditional on what information.

For example, an estimate of a clinic’s latent tendency to have higher event rates is not itself a predicted event for a patient. Nor is the distribution of effects for future clinics an estimate of the effect for a clinic already observed. The distinctions matter for both numerical results and uncertainty statements.

Model Setup and Three Prediction Targets

Write \(Y_{ij}\) for the response of unit \(j\) in group \(i\), \(x_{ij}\) for its fixed-effect covariates, and \(b_i\) for its latent group effect. A standard GLMM specifies the conditional response distribution given the group effect and covariates, with conditional mean

$$ g\{E(Y_{ij}\mid b_i,x_{ij})\}=x_{ij}^{\mathsf T}\beta+z_{ij}^{\mathsf T}b_i. $$

Here \(g\) is the link function, \(\beta\) is the fixed-effects vector, and \(z_{ij}\) identifies how the group effect enters the linear predictor. The random effects are modeled as draws from a population distribution, commonly with mean zero and covariance matrix \(D\). For a prediction to have its usual interpretation, the conditional response distribution and random-effects distribution must be appropriate for the data, and the groups being treated as new must be exchangeable with the modeled group population.

Definition: An observed-group latent-effect prediction concerns \(b_i\) for a group whose outcomes have been observed. A new-group latent-effect prediction concerns a random effect \(b_{\mathrm{new}}\) drawn for a group with no outcomes in the fitted data. A conditional response prediction concerns a future or unobserved response \(Y\), conditional on specified covariates and a specified group effect. An integrated response prediction averages over uncertainty or variation in the group effect rather than holding it fixed.

The observed-group target uses the group’s outcomes as information about its latent effect. A prediction can be summarized by a conditional mean or mode, for example, but these summaries are not identical in every model. The target remains the group’s latent effect, not an outcome. In contrast, the new-group effect has not been informed by outcomes from that group; under the model its distribution is the random-effects population distribution.

A response target adds another layer. Even if \(b_i\) is known, the response is generally random under the conditional response model. If \(b_i\) is uncertain, a response prediction may also need to account for that uncertainty. If model parameters are estimated rather than treated as fixed, their uncertainty can contribute as well. State explicitly which of these layers a reported interval or predictive distribution includes.

Worked Example: A Latent Effect for an Observed Group

Worked Example: A Latent Effect for an Observed Group

Suppose a hypothetical fitted binary-response GLMM has a random intercept \(b_A\) for clinic A. For illustration, assume the model-based conditional distribution of this effect given clinic A’s observed data and fixed fitted parameters is supplied as \(N(0.35,0.16)\). The second argument is the variance, so the conditional standard deviation is \(\sqrt{0.16}=0.40\).

If the target is the conditional mean of clinic A’s latent effect, the prediction is \(0.35\) on the model’s linear-predictor scale. A normal-based 95% interval from the supplied distribution is

$$ 0.35\pm1.96(0.40) =0.35\pm0.784 =(-0.434,\ 1.134). $$

Under the stated conditional distribution, this interval covers 95% of the distribution for \(b_A\). It is an interval for a latent log-odds shift if the model uses a logistic link and a random intercept. It is not an interval for clinic A’s event probability, and it is not a 95% probability statement about a fixed unknown effect in a frequentist interpretation.

The calculation assumes the supplied conditional distribution is suitable for this group and treats the fitted parameters as fixed. It does not show how that distribution was obtained. If parameter uncertainty is material, an interval conditional on fixed parameter estimates may understate total uncertainty.

Worked Example: An Effect for a New Group

Worked Example: An Effect for a New Group

Suppose a hypothetical model assigns new-group random intercepts the distribution \(b_{\mathrm{new}}\sim N(0,0.49)\). No outcomes have been observed for the new group, so there is no group-specific outcome information to update this distribution. Its mean is 0 and its standard deviation is \(\sqrt{0.49}=0.70\).

A central 95% interval under this normal population distribution is

$$ 0\pm1.96(0.70)=(-1.372,\ 1.372). $$

This interval describes the model’s variation in latent intercepts across new groups, on the linear-predictor scale. It does not say that a particular new group has a 95% chance of possessing a fixed effect inside the interval. In a predictive interpretation, it describes the central 95% of effects for new groups generated under the assumed population model.

This target differs from the observed-group target in the previous example. The first used information from a particular clinic’s observed outcomes; this one uses the assumed distribution for the group population. The interval is not a confidence interval for the population variance, and it does not include uncertainty in that variance unless such uncertainty has been incorporated separately.

Worked Example: A Response Conditional on the Group Effect

Worked Example: A Response Conditional on the Group Effect

Consider a hypothetical logistic random-intercept model with fixed intercept \(\beta_0=-1.2\), fixed slope \(\beta_1=0.8\), covariate value \(x=1\), and a specified group effect \(b=0.3\). For a unit in that group, the conditional linear predictor is

$$ \eta=-1.2+0.8(1)+0.3=-0.1. $$

With the logistic link, the conditional event probability is

$$ P(Y=1\mid b=0.3,x=1) =\frac{\exp(-0.1)}{1+\exp(-0.1)} \approx 0.4750. $$

Thus the conditional expected response is \(0.4750\), or a 47.50% event probability, for a unit with \(x=1\) in a group whose effect is fixed at \(0.3\). If the response is Bernoulli, a future outcome is still either 0 or 1; \(0.4750\) is its conditional probability of being 1, not a predicted individual outcome guaranteed to equal \(0.4750\).

If the group effect is uncertain instead of fixed, the probability relevant to prediction may average the conditional probability over the group-effect distribution. For illustration, suppose a hypothetical conditional distribution for an observed group places probability \(0.5\) at \(b=0\) and probability \(0.5\) at \(b=1\), with the same fixed part \(-1.2+0.8(1)=-0.4\). The integrated event probability is

$$ 0.5\frac{\exp(-0.4)}{1+\exp(-0.4)} +0.5\frac{\exp(0.6)}{1+\exp(0.6)} =0.5(0.4013)+0.5(0.6457) \approx 0.5235. $$

This is a response probability averaged over the stated effect distribution. It is not the conditional probability at one specified \(b\), nor is it generally obtained by substituting the mean effect into the nonlinear response function. The distribution in this illustration is given directly to make the target distinction clear; no procedure for estimating it is implied.

A Short Justification: Why Response Prediction Has More Than One Variation Source

When parameters and covariates are held fixed, response variation can be separated into conditional response variation and variation in the conditional mean across possible group effects. The law of total variance gives

$$ \operatorname{Var}(Y\mid \text{data}) = E\{\operatorname{Var}(Y\mid b,\text{data})\mid\text{data}\} + \operatorname{Var}\{E(Y\mid b,\text{data})\mid\text{data}\}. $$

To see the identity, write \(Y-E(Y\mid\text{data})\) as \(\{Y-E(Y\mid b,\text{data})\}+\{E(Y\mid b,\text{data})-E(Y\mid\text{data})\}\), square, and take conditional expectations. The cross-product has expectation zero because \(E\{Y-E(Y\mid b,\text{data})\mid b,\text{data}\}=0\). The first term is the average conditional response variance; the second is variation in the conditional mean due to uncertainty or variation in \(b\). Consequently, an interval for a latent effect alone cannot serve as a predictive interval for a response.

Choosing Among Related Predictions

TargetInformation and conditioningWhat the result describes
Observed-group latent effectUses outcomes from that group; conditions on the fitted modelThe group’s latent deviation on the random-effect scale
New-group latent effectUses the random-effects population distribution; no outcomes from that groupVariation in effects across groups generated by the model
Response conditional on an effectConditions on covariates and a specified group effectA response mean, probability, rate, or distribution for a unit
Response integrated over effectsAverages the conditional response distribution over an effect distributionA population-averaged prediction or a prediction accounting for effect uncertainty

The main alternative to a group-conditional response prediction is an integrated, population-averaged response prediction. The former holds a group effect fixed; the latter averages over a defined distribution of effects. Another tempting shortcut is to set \(b=0\). That gives the conditional response for a group at the random-effects reference value, not automatically the average response over groups. For nonlinear links, these quantities generally differ.

These distinctions depend on the target population and model assumptions. A new group must be reasonably represented by the modeled random-effects population. A misspecified random-effects distribution, dependence between groups, or a change in how groups are selected can make population-based predictions poorly calibrated. Predictions for observed groups can also be unreliable when their data are sparse or atypical. None of these targets alone establishes a causal effect.

Diagnostics and Common Mistakes

A useful diagnostic is to write the target in words before computing it: “the latent intercept for this observed clinic,” “the effect for a randomly selected new clinic,” or “the event probability for a patient with these covariates conditional on this clinic effect.” Then check that the conditioning information and reported units match that sentence.

  • Wrong reasoning: “The predicted random effect is 0.35, so the predicted event probability is 35%.” Correction: A random effect is on the model’s linear-predictor scale; transform the full linear predictor through the inverse link to obtain a conditional response mean or probability.
  • Wrong reasoning: “The new clinic’s effect is zero because random effects have mean zero.” Correction: Zero is the population mean, not a known value for every new group. A new-group effect varies according to the random-effects distribution.
  • Wrong reasoning: “A conditional probability for one effect is the average probability across groups.” Correction: For an integrated prediction, average the response function over the specified effect distribution; nonlinear transformations make substitution of an average effect generally insufficient.
  • Wrong reasoning: “An interval for \(b_i\) is a prediction interval for a future \(Y_{ij}\).” Correction: A response prediction also reflects conditional response variation, and may additionally reflect uncertainty in the effect and fitted parameters.

When predictions seem implausible, first verify the target, response scale, link transformation, and whether the group is observed or new. Then assess whether the assumed response and random-effects distributions and the exchangeability of groups are credible. A numerical prediction can be computed correctly yet answer the wrong question.

Key takeaway: Separate the latent-effect target from the response target, and separate observed groups from new groups. State what is conditioned on and which sources of variation are included before interpreting a point prediction or interval.

Check Your Understanding

For each question, identify the target before interpreting the result. Solutions are included below.

  1. A model reports a conditional mean effect of \(-0.2\) for a clinic represented in the data. Is this an event probability? Solution: No. It is a prediction of that observed clinic’s latent effect on the model’s random-effect scale.
  2. A new-group random intercept is modeled as \(N(0,0.36)\). Find its standard deviation and a central 95% interval under this distribution. Solution: The standard deviation is \(\sqrt{0.36}=0.60\). The interval is \(0\pm1.96(0.60)=(-1.176,1.176)\), for new-group effects on the random-intercept scale.
  3. In a logistic GLMM, what does \(P(Y=1\mid b_i,x_{ij})\) describe? Solution: The event probability for a unit with covariates \(x_{ij}\), conditional on the specified group effect \(b_i\).
  4. Why is the conditional probability at \(b=0\) not necessarily the average event probability across groups? Solution: The inverse link is nonlinear, so applying it at the mean effect need not equal averaging the response probabilities over the effect distribution.
  5. What additional variation must a future-response prediction include beyond uncertainty about a latent group effect? Solution: It must include the conditional response variation given that effect; parameter uncertainty may also be included if the prediction is intended to account for estimated parameters.
Clinical Biostats