Tutorials › Generalized Linear Mixed Models (GLMM) › Predicting a Random Effect for a New Group

Prediction of Random Effects · Tutorial 468 of 698

Predicting a Random Effect for a New Group

Distinguish a new group’s population-level random-effect distribution from a data-informed group estimate, and use it to construct plug-in predictive distributions.

Advanced 12 min read

What You'll Learn

  • Explain why a group with no observed outcomes has no group-specific likelihood information.
  • Derive the new group’s plug-in random-effect distribution from the fitted population distribution.
  • Distinguish predicting a latent random effect from predicting a future response.
  • Average conditional response distributions over the random-effect distribution.
  • Identify assumptions, limitations, and common failures in new-group prediction.

Why a New Group Is Different

For a group already represented in the data, its outcomes can update what the model says about that group’s latent deviation from the population pattern. A group with no observed outcomes offers no such update. This does not mean the model cannot make predictions for the group: it means those predictions come from the fitted distribution of group effects, together with any observed covariates and the response model, rather than from group-specific outcome evidence.

That distinction matters because “predict the random effect” and “predict a response from the new group” are different tasks. The first concerns the latent group deviation itself. The second also includes the conditional response variability specified by the GLMM. Both can be addressed using the fitted model, but neither should be mistaken for a data-informed estimate of a particular new group’s deviation.

Definition: A new group is a group whose outcomes have not been used to update a group-specific random-effect distribution. In a fitted GLMM, its random effect is predicted using the model’s fitted population distribution for group effects, conditional on any modeled group-level information. With plug-in parameter estimates, this is the fitted distribution \(F(\,\cdot\,;\hat\psi)\), where \(\hat\psi\) denotes estimated distributional parameters.

For example, write a GLMM’s conditional linear predictor for observation \(i\) in group \(j\) as \(\eta_{ij}=x_{ij}^{T}\beta+z_{ij}^{T}b_j\). Here \(b_j\) is the group’s random-effect vector, and its distribution is specified by the model. For a new group, use a new draw \(b_*\) from that distribution. If the model says group effects are independent and identically distributed, then \(b_*\) is independent of the effects for previously observed groups, conditional on the model parameters.

Why There Is No Data-Informed Group Estimate

The key result follows directly from Bayes’ rule. For an observed group with outcomes \(y_j\), its conditional distribution for the random effect is proportional to the group’s likelihood times the population distribution for the effect. For a group with no outcomes, the likelihood contribution is the constant 1. Multiplying the population distribution by 1 leaves it unchanged.

$$ p(b_*\mid \text{no outcomes},\hat\psi) \propto p(\text{no outcomes}\mid b_*,\hat\psi)\,p(b_*\mid\hat\psi) = 1\cdot p(b_*\mid\hat\psi). $$

The proportionality constant is therefore already one, so the conditional distribution is exactly \(F(\,\cdot\,;\hat\psi)\). In particular, a posterior mean or mode for this group is just the corresponding summary of the fitted population distribution. If the random effect is modeled to have mean zero, the posterior mean is zero; that is a population-centered summary, not evidence that the particular group has no deviation. If the fitted distribution is asymmetric, its mean and mode need not coincide.

Result: Conditional on fitted parameters and the model’s assumptions, a group with no outcomes has no group-specific data update. Its plug-in predictive distribution for the latent effect is \(F(\,\cdot\,;\hat\psi)\). A single point summary suppresses the uncertainty represented by this distribution.

The result assumes the group truly contributes no outcome information and that its random effect follows the fitted distribution appropriate to that group. If the model specifies a distribution conditional on known group-level covariates, those covariates can affect the distribution even when the group has no outcomes. They still do not supply outcome-based evidence about that group’s realized deviation.

Worked Example: A New Group’s Latent Effect

Suppose a fitted model assigns a scalar group effect \(b_j\) the hypothetical distribution \(P(b_j=-0.8)=0.5\) and \(P(b_j=0.8)=0.5\). A new group has no observed outcomes. Find its predictive distribution and its posterior mean.

Distribution. With no outcomes, the likelihood is 1 at either possible value. Thus the posterior probabilities remain \(0.5\) and \(0.5\):

$$ P(b_*=-0.8\mid\text{no outcomes})=0.5,\qquad P(b_*=0.8\mid\text{no outcomes})=0.5. $$

Mean. The posterior mean is the fitted population mean:

$$ E(b_*\mid\text{no outcomes}) =0.5(-0.8)+0.5(0.8) =-0.4+0.4 =0. $$

The value 0 summarizes the center of the distribution; it does not establish that this particular group has \(b_*=0\). In fact, under this illustrative distribution, the group effect can only be \(-0.8\) or \(0.8\). The posterior mode is tied at both supported values.

From the Random-Effect Distribution to Response Predictions

A future response depends on both the new group’s latent effect and the conditional response model. Let \(Y_*\) denote a response in the new group at specified covariates \(x_*,z_*\). The plug-in predictive distribution averages the conditional response distribution over possible group effects. This averaging is often called integration over the random effects; for a discrete distribution it is a weighted sum.

$$ P(Y_*\in A\mid x_*,z_*,\hat\beta,\hat\psi) = \int P(Y_*\in A\mid b_*,x_*,z_*,\hat\beta)\, dF(b_*;\hat\psi). $$

Here \(A\) is any set of response values. The conditional probability inside the integral comes from the GLMM’s response distribution and link function. The integral accounts for uncertainty about which random effect the new group will have. In general, evaluating the response model at the mean random effect is not equivalent to averaging the conditional response probabilities.

Worked Example: A Binary Response in a New Group

Consider a hypothetical logistic random-intercept model with fitted fixed intercept \(\hat\beta_0=-1.0\). At the covariate values of interest, other fixed-effect contributions are zero. Suppose the fitted random intercept has probability \(0.5\) at each of \(-0.8\) and \(0.8\). Find the plug-in probability of a positive response for one observation in a new group.

The conditional success probability at a given random intercept is \(\operatorname{logit}^{-1}(\hat\beta_0+b_*)=1/(1+\exp[-(\hat\beta_0+b_*)])\). For \(b_*=-0.8\), the linear predictor is \(-1.8\), giving probability \(1/(1+e^{1.8})\). For \(b_*=0.8\), it is \(-0.2\), giving probability \(1/(1+e^{0.2})\). The predictive probability averages these values using their fitted probabilities:

$$ \begin{aligned} P(Y_*=1) &=0.5\frac{1}{1+e^{1.8}} +0.5\frac{1}{1+e^{0.2}}\\ &\approx 0.5(0.141851)+0.5(0.450166)\\ &\approx 0.2960085 \approx 0.2960. \end{aligned} $$

Thus the plug-in probability of a positive response is about 0.2960 at these covariate values, for a response in a randomly drawn new group under the fitted model. This is a population-averaged prediction over possible group effects. It is not the conditional probability for every group, nor is it an estimate of the new group’s realized intercept.

Worked Example: A Poisson Prediction and a Nonlinear Average

Suppose a hypothetical Poisson random-intercept model has fitted baseline log rate \(\log(3)\), and a new group’s effect is \(-\log(2)\) or \(+\log(2)\), each with probability \(0.5\). Find the predictive mean count and the probability of observing zero for one exposure unit.

Conditional on \(b_*\), the Poisson mean is \(\lambda(b_*)=\exp(\log(3)+b_*)\). At \(b_*=-\log(2)\), this is \(3/2=1.5\); at \(b_*=+\log(2)\), it is \(3(2)=6\). Therefore the predictive mean is

$$ E(Y_*)=0.5(1.5)+0.5(6)=0.75+3=3.75. $$

For a Poisson variable with mean \(\lambda\), the conditional probability of zero is \(e^{-\lambda}\). Averaging the two conditional probabilities gives

$$ P(Y_*=0) =0.5e^{-1.5}+0.5e^{-6} \approx 0.5(0.223130)+0.5(0.002479) \approx 0.1128. $$

The predictive mean is 3.75 counts per exposure unit, and the probability of zero counts is about 0.1128. In particular, applying the inverse link to the mean effect would give \(\exp(\log(3)+E(b_*))=3\), not the predictive mean 3.75. The difference occurs because exponentiation is nonlinear: averaging conditional means is not the same as evaluating the conditional mean at the average random effect.

Assumptions, Diagnostics, and Alternatives

These predictions rely on the fitted model being a reasonable description of the population of groups to which the new group belongs. In particular, the model must specify a suitable random-effect distribution, the new group must be exchangeable with the groups used to fit it (or have its own correctly specified conditional distribution), and the response distribution and link must be suitable. The prediction also conditions on estimated parameters in the examples above; treating estimates as fixed omits parameter-estimation uncertainty.

For a new-group response, the predictive distribution includes variation from both the random effect and the conditional response distribution. A predictive interval or tail probability should therefore be calculated from the mixture distribution, not just from the uncertainty in a group-effect summary. If uncertainty in \(\hat\beta\) and \(\hat\psi\) is material, a fuller prediction should additionally account for uncertainty in those fitted parameters.

Useful checks include comparing the fitted random-effect distribution with the information supported by observed groups, checking whether predictions are sensitive to its assumed shape or estimated variability, and assessing conditional response fit. For example, systematic lack of fit in predicted binary probabilities or count distributions can undermine new-group predictions even if the random-effect distribution appears plausible. A variance estimate near zero also makes the fitted distribution concentrate near its center, so predictions may approach those from a model without group variation; this is not proof that all future groups are identical.

The main alternatives answer different questions. A prediction at \(b_*=0\) describes a group at the population center, not a randomly selected group averaged over the fitted effects. A conditional prediction at a specified \(b_*\) assumes that effect value is known. A response prediction that ignores random effects can omit between-group variation. The new-group mixture instead averages over the fitted effect distribution. None of these choices can recover an outcome-informed estimate for a group that has supplied no outcomes.

Common mistake: “The new group has no data, so its empirical Bayes estimate is zero, and its predicted response is the response at random effect zero.” The correction is that zero is, at most, a center summary when the fitted distribution is centered at zero. The group’s effect remains distributed according to \(F(\,\cdot\,;\hat\psi)\), and a new-group response prediction averages the conditional response distribution over that entire fitted distribution.

Practical Workflow

1
Specify the prediction target.
Decide whether the target is the latent effect \(b_*\), a response probability, a count distribution, or another response quantity at stated covariates.
2
Use the new-group effect distribution.
For a group without outcomes, use the fitted population distribution, or its model-specified version conditional on known group-level information.
3
Average for response predictions.
Integrate the conditional response distribution over possible effects; do not substitute a point summary unless that is explicitly the intended target.
4
State what uncertainty is included.
Distinguish random-effect and response variability from uncertainty in fitted parameters, and report the prediction’s covariate and exposure context.

The central limitation is that the distribution is learned from the observed groups and the model assumptions. It may be poorly estimated when few groups are available, misspecified if the new group comes from a different population, or insufficient when relevant group-level predictors have been omitted. New-group prediction is therefore a model-based population prediction, not a substitute for data from the particular group.

Check Your Understanding

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

  1. If a new group has no outcomes and its fitted random-effect distribution has mean zero, what does a posterior mean of zero establish about its realized effect?
  2. A new group’s effect is \( -1 \) or \(1\), each with probability \(0.5\). A logistic model has fixed linear predictor \(-0.5\) before adding the effect. Write the formula for the predictive success probability.
  3. Why can the predictive mean in a log-link model differ from the conditional mean evaluated at the mean random effect?
  4. Name two sources of uncertainty in a future response prediction and one additional source omitted by a plug-in calculation.

Solutions. (1) It establishes only that the fitted population distribution’s mean is zero; it does not establish the realized effect for this group. (2) The formula is \(0.5/[1+\exp(1.5)]+0.5/[1+\exp(-0.5)]\), averaging the logistic probabilities at linear predictors \(-1.5\) and \(0.5\). (3) The inverse link is nonlinear, so averaging conditional means over effects generally differs from evaluating the inverse link at the average effect. (4) Random-effect variability and conditional response variability are included; uncertainty in fitted parameters is omitted when \(\hat\beta\) and \(\hat\psi\) are treated as fixed.

Clinical Biostats