Tutorials › Generalized Linear Mixed Models (GLMM) › Predictions For New Clusters By Integration

Marginal Effects and Population-Averaged Estimates · Tutorial 430 of 698

Predictions For New Clusters By Integration

You will construct population-averaged predictions for new clusters by integration and compare them with conditional predictions for clusters whose effects are known or estimated.

Advanced 13 min read

What You'll Learn

  • Define a new-cluster prediction by integrating the conditional mean over the random-effects distribution.
  • Distinguish integration over random effects from setting the random effect to zero.
  • Calculate integrated predictions for logistic, probit, and Poisson random-intercept models.
  • Account for random-effects distributions that depend on covariates.
  • Identify assumptions, numerical integration checks, and common prediction errors.

Why a New Cluster Requires Integration

A fitted GLMM can describe outcomes conditional on a cluster’s random effect. That is useful when predicting for a cluster whose effect is known or has been estimated from its data. For a cluster not represented in the data, however, its effect is not known. A prediction for such a cluster must account for the range of effects that the model says new clusters can have.

The key operation is to calculate the conditional mean at each possible random effect and average those means according to the random-effects distribution. This is a population-averaged prediction for the specified covariate values. It is generally not the same as substituting the mean random effect into the conditional model, although the two can agree in special cases.

Definition: Let \(Y_{\mathrm{new}}\) be an outcome in a new cluster, let \(x\) denote its specified covariates, and let \(b_{\mathrm{new}}\) be that cluster’s random effect. Suppose the conditional mean is \(E(Y_{\mathrm{new}}\mid x,b_{\mathrm{new}})=g^{-1}\{\eta(x)+z(x)^T b_{\mathrm{new}}\}\), where \(g^{-1}\) is the inverse link. A new-cluster population-averaged prediction is \(E(Y_{\mathrm{new}}\mid x)=\int g^{-1}\{\eta(x)+z(x)^T b\}\,dF(b\mid x)\). Here \(F(b\mid x)\) is the assumed random-effects distribution for a new cluster at covariates \(x\). If the distribution does not depend on \(x\), this is simply \(F(b)\).

In applications, the model parameters and the random-effects distribution are estimated. A plug-in prediction uses those estimates in the integral. The prediction is an average over possible cluster effects under the fitted model; it is not an estimate of the particular effect of any one new cluster. It also gives the expected response, not a guarantee about the outcome of an individual observation.

Assumptions and the Averaging Operation

For the formula to have its intended interpretation, the conditional mean model must be appropriate for the outcome, link, and covariates. The random-effects distribution must represent the cluster variation relevant to the target population. In a standard random-intercept model, for example, one may assume \(b_i\sim N(0,\sigma_b^2)\), with cluster effects independent across clusters and independent of the covariates. When the distribution depends on covariates, the integration instead uses the specified \(F(b\mid x)\); this is important when applying the earlier material on marginalization under covariate-dependent cluster effects.

The conditional outcome distribution also matters for predictions beyond the mean. For example, a Poisson GLMM assumes a Poisson outcome conditional on the random effect and covariates. But if the requested prediction is only the expected outcome, integrating the conditional mean is sufficient by the law of total expectation:

$$ E(Y_{\mathrm{new}}\mid x) =E_{b_{\mathrm{new}}\mid x}\{E(Y_{\mathrm{new}}\mid x,b_{\mathrm{new}})\} =\int E(Y_{\mathrm{new}}\mid x,b)\,dF(b\mid x). $$

This identity justifies averaging conditional means rather than averaging linear predictors. For a nonlinear inverse link, \(E_b\{g^{-1}(\eta+z^Tb)\}\) need not equal \(g^{-1}(\eta+z^TE(b))\). It is not guaranteed that these expressions differ in every particular case: a linear inverse link gives equality, and symmetry or other special structure can also produce equality.

Worked Example: A Logistic Prediction for a New Cluster

Suppose a hypothetical binary-outcome random-intercept model has conditional probability \(\operatorname{logit}^{-1}(-1+b)\), with a new-cluster effect \(b\sim N(0,0.64)\). Thus the random-effect standard deviation is \(0.8\). Estimate the new-cluster probability using three-point normal quadrature, and compare it with the probability at \(b=0\).

For a standard normal variable, the three-point quadrature approximation uses nodes \(0\) and \(\pm\sqrt{3}\), with respective weights \(2/3\), \(1/6\), and \(1/6\). Scaling by \(0.8\), the nodes for \(b\) are \(0\) and \(\pm0.8\sqrt{3}\), approximately \(0\) and \(\pm1.386\). The integral is approximated by

$$ \begin{aligned} E_b\{\operatorname{logit}^{-1}(-1+b)\} &\approx \frac{2}{3}\operatorname{logit}^{-1}(-1) +\frac{1}{6}\operatorname{logit}^{-1}(-1+1.386) +\frac{1}{6}\operatorname{logit}^{-1}(-1-1.386)\\ &\approx \frac{2}{3}(0.2689)+\frac{1}{6}(0.5953)+\frac{1}{6}(0.0843)\\ &\approx 0.2925. \end{aligned} $$

The new-cluster prediction is therefore about \(0.293\), or a 29.3% probability, under this quadrature approximation. Setting \(b=0\) instead gives \(\operatorname{logit}^{-1}(-1)=0.2689\), about 26.9%. That is the conditional prediction for a cluster with effect zero, not in general the population average. The quadrature value is an approximation to the integral; a numerical implementation should check that adding quadrature points does not materially change the result.

Exact Integration in Useful Special Cases

Some models allow an exact integral, which makes the distinction between conditional and population-averaged predictions especially clear. For a probit random-intercept model, the normal distribution of the random effect combines with the probit link to yield a closed-form marginal probability.

Worked Example: Exact Probit Integration

Consider a hypothetical binary-outcome model with conditional success probability \(\Phi(0.5+b)\), where \(b\sim N(0,1)\) for a new cluster and \(\Phi\) is the standard normal cumulative distribution function. The integrated probability is

$$ E_b\{\Phi(0.5+b)\} =\Phi\left(\frac{0.5}{\sqrt{1+1}}\right) =\Phi(0.3536) \approx 0.6382. $$

To justify the identity, let \(Z\) and \(E\) be independent standard normal variables. Conditional on \(Z\), \(\Phi(0.5+Z)\) is \(P(E\leq0.5+Z\mid Z)\). Averaging over \(Z\) gives

$$ \begin{aligned} E\{\Phi(0.5+Z)\} &=P(E-Z\leq0.5)\\ &=\Phi\left(\frac{0.5}{\sqrt{\operatorname{Var}(E-Z)}}\right) =\Phi\left(\frac{0.5}{\sqrt{2}}\right), \end{aligned} $$

because \(E-Z\) is normal with mean zero and variance \(1+1=2\). The conditional probability at \(b=0\) is \(\Phi(0.5)\approx0.6915\), which is not the integrated probability here. This calculation relies on the probit link and normal random intercept; the identity should not be transferred automatically to other links.

For a log-link model with a normal random intercept, a different exact identity applies to the mean. If the conditional mean is \(\exp(\eta+b)\) and \(b\sim N(0,\sigma_b^2)\), then the moment-generating function of a normal variable gives

$$ E_b\{\exp(\eta+b)\} =\exp(\eta)E_b\{\exp(b)\} =\exp\left(\eta+\frac{\sigma_b^2}{2}\right). $$

Worked Example: A Poisson Mean for a New Cluster

Suppose a hypothetical Poisson random-intercept model has conditional mean \(\exp(\eta+b)\), with \(\exp(\eta)=4\) events per exposure unit and \(b\sim N(0,0.25)\). The population-averaged expected rate is

$$ E_b\{\exp(\eta+b)\} =4\exp(0.25/2) =4\exp(0.125) \approx 4.532. $$

Thus the fitted model predicts an average of about 4.532 events per exposure unit for new clusters at these covariates. For comparison, a cluster with known effect \(b=0.3\) has conditional expected rate \(\exp(\eta+0.3)=4\exp(0.3)\approx5.399\) events per exposure unit. The second number is conditional on that cluster effect; it does not average over the distribution of effects in new clusters.

New Clusters Versus Existing Clusters

A new cluster’s effect is integrated over its population distribution. An existing cluster may instead have outcome data that inform its effect. If its effect were known to equal \(b_i\), the conditional prediction would be \(g^{-1}\{\eta(x)+z(x)^Tb_i\}\). In practice \(b_i\) is usually not known, so a fitted conditional prediction may substitute an estimated cluster effect, often an empirical Bayes estimate. A prediction that accounts for uncertainty about that existing effect can average over its conditional distribution given the cluster’s data. These are different targets from averaging over the distribution for a new cluster.

Prediction targetRandom-effect treatmentInterpretation
New clusterIntegrate over the fitted population distributionExpected outcome for a cluster drawn from the target cluster population
Existing cluster with known effectSubstitute its known effectConditional mean for that cluster
Existing cluster with estimated effectSubstitute an estimate, or average over its conditional distributionPrediction informed by that cluster’s observed outcomes
Zero-effect reference clusterSet \(b=0\)Conditional mean at the random-effect reference value, not generally the population average

The comparison is not a choice between a “correct” prediction and an “incorrect” one. The prediction must match the question. A new-cluster prediction is appropriate when the future cluster has no cluster-specific outcome data and the target is the model’s cluster population. A conditional prediction is appropriate when the goal is to describe a specified cluster using its effect. In either case, estimated fixed effects and variance components are treated as fixed in the plug-in calculation; the resulting prediction alone does not incorporate their estimation uncertainty.

Numerical Checks, Failure Modes, and Limits

Integration can be analytic, as in the probit and log-link examples, or numerical, as in the logistic example. Numerical integration is part of the calculation, not a cosmetic implementation detail. Check that the result is stable when the number of quadrature points or the integration method changes. For simulated integration, use enough draws to make Monte Carlo error small relative to the precision being reported.

  • Check the target population. The random-effects distribution used in the integral must correspond to the new clusters of interest. If it depends on covariates, use \(F(b\mid x)\), rather than an unconditional distribution that does not match the target.
  • Check model fit and support. A normal random-effects distribution is an assumption, not a universal description of cluster heterogeneity. Predictions may be unreliable when the distributional form is poor or the covariates are far outside the observed range.
  • Check the conditional model. A well-computed integral cannot repair a misspecified link, mean structure, or conditional outcome distribution. For count predictions, exposure offsets and the units of the rate must also be handled correctly.
  • Watch for boundary or unstable variance estimates. If the estimated random-effect variance is near zero, the integrated prediction may be close to the zero-effect conditional prediction. That agreement does not establish that the model or target is correct.

A common mistake is to set \(b=E(b)=0\) and call the result the prediction for a new cluster. This calculates the conditional mean for a zero-effect cluster. For a nonlinear inverse link, the average of conditional means need not equal that value; the logistic example produced 0.2925 by integration versus 0.2689 at zero. Conversely, it is also a mistake to claim that nonlinearity always forces a difference: the probit calculation shows that special distributions and links can yield useful exact relationships, and a symmetric logistic random-intercept model with linear predictor zero has integrated probability exactly 0.5 by symmetry. The distinction is about the estimand and the integral, not a blanket rule that the two values must differ.

Key takeaway: To predict for a new cluster, average the conditional response mean over the random-effects distribution appropriate to the target population and covariates. Use a conditional effect for a cluster-specific prediction; do not silently substitute zero or an existing cluster’s estimated effect.

Check Your Understanding

Answer each question, then compare with the brief solutions.

  1. A logistic random-intercept model has conditional probability \(\operatorname{logit}^{-1}(0+b)\), where a new cluster’s \(b\sim N(0,1)\). What is the integrated probability, and why?
  2. For a probit random-intercept model, the conditional probability is \(\Phi(1+b)\), with \(b\sim N(0,3)\). Calculate the integrated probability using the normal-probit identity.
  3. A Poisson log-link model has conditional mean \(\exp(\eta+b)\), \(\exp(\eta)=2\), and \(b\sim N(0,0.36)\). Find the new-cluster mean and state its units if the outcome is a count per day.
  4. Explain why substituting an estimated effect from an observed cluster is not generally a new-cluster prediction.

Solutions. (1) The integral is \(E\{\operatorname{logit}^{-1}(b)\}\). Since the standard normal distribution is symmetric and \(\operatorname{logit}^{-1}(-b)=1-\operatorname{logit}^{-1}(b)\), the two symmetric contributions average to \(0.5\); in this particular case the integrated probability is exactly 0.5. (2) The variance of \(b\) is 3, so the integrated probability is \(\Phi\{1/\sqrt{1+3}\}=\Phi(0.5)\approx0.6915\). (3) The new-cluster expected count rate is \(2\exp(0.36/2)=2\exp(0.18)\approx2.394\) counts per day. (4) An estimated effect for an observed cluster is informed by that cluster’s outcomes; the new-cluster prediction instead averages over the population distribution for a cluster with no such cluster-specific outcome information.

Clinical Biostats