Tutorials › Generalized Linear Mixed Models (GLMM) › Empirical Bayes Predictions for Sparse Groups

Prediction of Random Effects · Tutorial 462 of 698

Empirical Bayes Predictions for Sparse Groups

Learn to calculate and interpret empirical Bayes predictions for groups with little binary or count information, and to diagnose when the predictions are strongly influenced by the population-level model.

Advanced 12 min read

What You'll Learn

  • Define an empirical Bayes group prediction using plug-in estimates of the GLMM parameters.
  • Derive why a group with little likelihood information is strongly shrunk toward the population level.
  • Calculate a binary random-intercept prediction when every observed response is a success.
  • Calculate a Poisson random-intercept prediction from a sparse count.
  • Distinguish a small number of observations from genuinely low within-group information.
  • Recognize diagnostics and limitations of predictions for sparse groups.

Why Sparse Groups Need Careful Prediction

A group with only a few observations can show an extreme outcome by chance. For example, if both of two responses are successes, the observed proportion is 1. A binary GLMM does not usually treat that raw proportion as a precise estimate of the group’s underlying response probability. It combines the group’s data with a model in which group effects are drawn from a population distribution. When the group contributes little information, its predicted effect is pulled toward the population level. This is shrinkage.

Sparse does not simply mean “few rows.” In a binomial model, the number of trials and the fitted probabilities matter. In a count model, both the count and its exposure matter. The useful question is how much the group’s likelihood informs its latent effect, relative to the assumed spread of effects across groups.

Definition: In an empirical Bayes prediction, the group effect \(b_j\) is predicted from its observed data conditional on estimated population-level parameters. In this tutorial, \(\hat b_j\) denotes the conditional mode: the value of \(b_j\) that maximizes the group’s conditional log likelihood plus the log density of its random-effects distribution, with model parameters replaced by estimates. The prediction is “empirical Bayes” because those population-level parameters, including the random-effect variance, are estimated from the data.

For the examples, consider a random-intercept model with \(b_j\sim N(0,\tau^2)\). Conditional on \(b_j\), binary responses have logit probability \(\eta_j=\mathbf{x}_j^\mathsf{T}\boldsymbol{\beta}+b_j\), while counts have log mean \(\eta_j=\mathbf{x}_j^\mathsf{T}\boldsymbol{\beta}+b_j\), with an exposure multiplier when needed. The random effects are assumed independent across groups, and the responses are conditionally independent given the random effects and covariates. These are model assumptions, not guarantees supplied by the small group’s data.

How Sparse Information Produces Shrinkage

For one group, write its conditional log likelihood as \(\ell_j(b)\), and suppose its random intercept has distribution \(N(0,\tau^2)\). Apart from terms that do not depend on \(b\), the log conditional density being maximized is

$$ q_j(b)=\ell_j(b)-\frac{b^2}{2\tau^2}. $$

Thus the group data pull the prediction toward values favored by \(\ell_j(b)\), while the normal random-effects distribution penalizes large departures from zero. The conditional mode satisfies

$$ \ell_j'(\hat b_j)-\frac{\hat b_j}{\tau^2}=0. $$

A small amount of likelihood information means that a modest departure from zero can balance the prior penalty. This gives a useful local derivation of the shrinkage effect. If the group log likelihood is approximately quadratic around its own maximum \(b_{Lj}\), with curvature \(I_j>0\), then

$$ \ell_j(b)\approx C-\frac{I_j}{2}(b-b_{Lj})^2. $$

Combining this approximation with the normal penalty and setting the derivative to zero gives

$$ -I_j(b-b_{Lj})-\frac{b}{\tau^2}=0 \quad\Longrightarrow\quad \hat b_j\approx \frac{\tau^2 I_j}{1+\tau^2 I_j}\,b_{Lj}. $$

The multiplier is between 0 and 1. When \(I_j\) is small, the multiplier is small and the prediction is near zero; when \(I_j\) is large, the multiplier approaches 1. This is a local approximation, not a universal formula for nonlinear GLMM predictions. In particular, a group with all successes or all failures may have no finite unpenalized likelihood estimate \(b_{Lj}\), even though its penalized conditional mode is finite.

Worked Example: Two Successes in a Sparse Binary Group

Suppose a hypothetical group has \(m=2\) binary observations, both successes. Let the fitted fixed part of the linear predictor be zero, and let the estimated random-intercept variance be \(\hat\tau^2=1\). These are plug-in values for the example. The group log likelihood, up to a constant, is \(2b-2\log(1+\exp(b))\). Adding the normal penalty gives the score equation

$$ 2-2\operatorname{expit}(b)-b=0, \qquad \operatorname{expit}(b)=\frac{\exp(b)}{1+\exp(b)}. $$

At \(b=0.675\), \(\operatorname{expit}(0.675)\approx0.6626\), so the score is \(2-2(0.6626)-0.675\approx-0.0002\). Solving the equation more closely gives \(\hat b_j\approx0.6748\). The predicted conditional probability is therefore

$$ \operatorname{expit}(0+0.6748)\approx0.6626. $$

The observed proportion is 2/2 = 1, but the fitted group probability is about 0.663. The group’s two successes move its prediction above the population-level probability of 0.5, while the random-effects distribution pulls it back from the extreme raw proportion. The score equation is strictly decreasing because its derivative is \(-2p(1-p)-1<0\), where \(p=\operatorname{expit}(b)\); hence the root is unique.

Worked Example: Same Raw Proportion, More Binary Information

Now consider a second hypothetical group with 20 successes in 20 trials, keeping the fitted fixed part at zero and \(\hat\tau^2=1\). Its score equation is

$$ 20-20\operatorname{expit}(b)-b=0. $$

At \(b=2.127\), \(\operatorname{expit}(b)\approx0.8935\), giving a score of approximately \(20-20(0.8935)-2.127=0.003\). The root is about \(\hat b_j=2.128\), and the predicted conditional probability is about \(\operatorname{expit}(2.128)=0.8936\). It is still below the observed proportion of 1, but it is much closer than the prediction for two successes in two trials.

The raw proportions are identical, yet the group with 20 trials provides more information about its probability. In both cases the conditional mode is finite because of the random-effects penalty; the ordinary group-specific binomial likelihood alone has no finite maximum when every response is a success. This comparison concerns information within each group, conditional on the same fitted population-level values.

Count Data: Counts and Exposure Both Matter

For a Poisson random-intercept model with known exposure \(e_j\), let the conditional mean be \(\mu_j=e_j\exp(\mathbf{x}_j^\mathsf{T}\boldsymbol{\beta}+b_j)\). For a group with count \(y_j\), the derivative of its log likelihood with respect to \(b_j\) is \(y_j-\mu_j\). Adding the normal random-effects penalty yields the score equation

$$ y_j-e_j\exp(\mathbf{x}_j^\mathsf{T}\boldsymbol{\beta}+\hat b_j) -\frac{\hat b_j}{\tau^2}=0. $$

The equation makes clear that a count alone does not describe the group’s information. A zero count over a long exposure can be stronger evidence for a low rate than a zero count over a very short exposure. Likewise, a small count may be informative when the exposure and expected count are both small, but one must assess that information relative to the model’s fitted mean and random-effect variance.

Worked Example: One Event in a Sparse Poisson Group

Suppose a hypothetical group has count \(y_j=1\) over exposure \(e_j=1\). Let the fitted fixed part be \(\log(2)\), so the population-level expected count over this exposure is 2, and let \(\hat\tau^2=0.25\). The conditional-mode equation becomes

$$ 1-2\exp(b)-\frac{b}{0.25}=0, \quad\text{or}\quad 1-2\exp(b)-4b=0. $$

At \(b=-0.171\), the score is \(1-2\exp(-0.171)-4(-0.171)\approx1-1.6856+0.684=-0.0016\). The root is approximately \(\hat b_j=-0.1713\). The predicted conditional mean count over exposure 1 is

$$ \hat\mu_j=\exp(\log(2)-0.1713) =2\exp(-0.1713)\approx1.685. $$

The single observed event moves the predicted mean below the population-level value of 2, but not all the way to the observed count of 1. The likelihood score decreases with \(b\), since its derivative is \(-2\exp(b)-4<0\), so this root is unique. The interpretation is a fitted conditional mean count for this group under the model, not a claim that its next observed count will equal 1. The next count remains random.

Diagnostics, Alternatives, and Limitations

For sparse groups, report the prediction alongside the amount and type of group-specific information. Useful checks include the group’s number of trials or exposure, its observed outcome pattern, and whether the fitted probability or mean is near a boundary. Inspect the conditional-mode score at the reported prediction: it should be near zero. Also check that the prediction is stable to reasonable changes in the fitted fixed effects and \(\hat\tau^2\). If the random-effect variance is estimated close to zero, predictions may be close to zero for nearly all groups; that behavior reflects the fitted model and should not be mistaken for strong group-specific evidence.

A raw group proportion or rate is a simple alternative, but it ignores the distribution of group effects and can be highly unstable for small denominators or exposures. A separate, unpooled group model avoids borrowing information across groups, but with sparse data it can yield extreme or undefined estimates, such as an infinite logit estimate for all successes. The empirical Bayes prediction borrows strength through the shared model. It is not automatically superior: misspecified fixed effects, an unsuitable random-effects distribution, or a poor variance estimate can systematically distort the predictions.

In practice, conditional modes are often obtained by numerical optimization rather than hand-solving score equations. Numerical convergence alone is not a diagnostic of model adequacy. Check for unusual group patterns, implausible fitted values, and sensitivity to the assumed random-effects distribution. Sparse data cannot reliably establish that a particular group truly has an extreme effect; the amount of shrinkage depends on estimated population-level parameters as well as that group’s outcomes. The prediction is also distinct from an uncertainty interval for the latent effect.

Common pitfall: “This group had 2 successes in 2 trials, so its estimated probability must be 1.” That is the raw proportion, not necessarily the empirical Bayes prediction. Under the fitted binary random-intercept model in the worked example, the prediction is about 0.663 because the group’s limited data are combined with the random-effects distribution. Conversely, shrinkage does not mean that every group receives the same prediction: more informative group data can produce a prediction farther from the population level.

Check Your Understanding

Answer each question using the conditional-mode prediction described above. Solutions follow the questions.

  1. For a binary group with one success in one trial, fitted fixed part zero, and \(\hat\tau^2=1\), write the score equation for its random-intercept prediction.
  2. Why can a group with 20 successes in 20 trials be predicted farther from the population level than a group with 2 successes in 2 trials, even though both raw proportions are 1?
  3. In the local quadratic approximation, what happens to the shrinkage multiplier when the group information \(I_j\) approaches zero?
  4. For a Poisson group, explain why the same zero count can represent different amounts of information under different exposures.

Solutions. (1) The equation is \(1-\operatorname{expit}(b)-b=0\), because the group has one success, one trial, fixed part zero, and prior variance 1. (2) The 20-trial group has more likelihood information about its response probability, so the likelihood can pull its conditional mode farther from zero against the same random-effects penalty. (3) The multiplier \(\tau^2 I_j/(1+\tau^2 I_j)\) approaches zero, so the approximate prediction approaches zero. (4) The expected count depends on exposure as well as rate. A zero count over a longer exposure can be less compatible with a high rate, and therefore more informative about the group effect, than a zero over a short exposure.

Clinical Biostats