Tutorials › Generalized Linear Mixed Models (GLMM) › Laplace Approximation with Cluster-Level Binomial Counts

Laplace Approximation and Adaptive Quadrature · Tutorial 193 of 698

Laplace Approximation with Cluster-Level Binomial Counts

Learn to construct and interpret the cluster-level binomial integrand, identify when grouping preserves the likelihood, and apply a Laplace approximation without dropping required constants.

Advanced 12 min read

What You'll Learn

  • Write the conditional and marginal likelihood contributions for grouped binomial counts under a random intercept.
  • Explain when a binomial count represents the same likelihood information as individual Bernoulli outcomes.
  • Find the conditional mode and curvature used in the one-dimensional Laplace approximation.
  • Distinguish likelihood factors that affect the integral from constants that do not affect its mode.
  • Diagnose invalid grouping and recognize conditions under which a Laplace approximation may be unreliable.

Why the Grouping Convention Matters

When several binary observations in a cluster share the same covariates, they can be represented by a success count and a trial count. This is a compact data representation, but it is important to distinguish two likelihoods: the probability of one particular sequence of individual outcomes, and the probability of observing a total count. The latter includes a binomial coefficient because many outcome sequences produce the same count.

In a generalized linear mixed model, the shared random intercept also induces dependence between outcomes in the same cluster after that intercept is integrated out. The right starting point is therefore the conditional likelihood given the intercept; the marginal cluster likelihood follows by integrating that conditional likelihood against the random-intercept distribution.

Model and assumptions: For cluster \(j\), suppose there are \(m_j\) binary trials with the same fixed-effects design vector \(x_j\). Conditional on a cluster random intercept \(b_j\), the outcomes are independent Bernoulli variables with success probability \(p_j(b_j)\), where \(\operatorname{logit}\{p_j(b_j)\}=x_j^\mathsf{T}\beta+b_j\). Assume the cluster intercepts are independent with \(b_j\sim N(0,\sigma_b^2)\), where \(\sigma_b^2>0\). The covariates and trial counts are treated as fixed, and the model has no additional within-cluster dependence once \(b_j\) is given.

From Individual Outcomes to the Cluster Integrand

Let \(Y_j=\sum_{i=1}^{m_j}Y_{ij}\) be the number of successes in cluster \(j\), and write its observed value as \(y_j\). Set \(\eta_j(b)=x_j^\mathsf{T}\beta+b\) and \(p_j(b)=\{1+\exp[-\eta_j(b)]\}^{-1}\). If the individual outcomes and their labels are retained, their conditional likelihood is \(p_j(b)^{y_j}\{1-p_j(b)\}^{m_j-y_j}\). If only the count is observed, its conditional probability is the binomial probability, which also includes \({m_j\choose y_j}\).

$$ P(Y_j=y_j\mid b_j=b) ={m_j\choose y_j}p_j(b)^{y_j}\{1-p_j(b)\}^{m_j-y_j} ={m_j\choose y_j} \frac{\exp\{y_j\eta_j(b)\}}{\{1+\exp(\eta_j(b))\}^{m_j}}. $$

The second equality follows from \(p=\exp(\eta)/(1+\exp(\eta))\) and \(1-p=1/(1+\exp(\eta))\). Integrating over the random intercept gives the marginal likelihood contribution of the count:

$$ L_j(\beta,\sigma_b^2) ={m_j\choose y_j}\int_{-\infty}^{\infty} \frac{\exp\{y_j\eta_j(b)\}}{\{1+\exp(\eta_j(b))\}^{m_j}} \frac{1}{\sqrt{2\pi\sigma_b^2}} \exp\!\left(-\frac{b^2}{2\sigma_b^2}\right)\,db. $$

For numerical work, separate the binomial coefficient and the normalizing constant of the normal density from the exponent. Define \(h_j(b)=y_j\eta_j(b)-m_j\log\{1+\exp(\eta_j(b))\}-b^2/(2\sigma_b^2)\). Then the likelihood is the integral of \(\exp\{h_j(b)\}\), multiplied by the factors outside that exponent:

$$ L_j(\beta,\sigma_b^2) =\frac{{m_j\choose y_j}}{\sqrt{2\pi\sigma_b^2}} \int_{-\infty}^{\infty}\exp\{h_j(b)\}\,db. $$

Worked Example: The Count Probability and an Individual Sequence

Suppose a cluster has \(m_j=5\) trials and \(y_j=2\) successes. At a specified intercept value \(b=0\), let its linear predictor be \(\eta_j(0)=\log 2\). Thus \(p_j(0)=2/3\). Find the conditional probability of the count and the conditional likelihood of one particular labelled sequence with two successes.

For the count, there are \({5\choose2}=10\) possible labelled sequences with two successes. Its probability is \[ {5\choose2}(2/3)^2(1/3)^3 =10\left(\frac{4}{9}\right)\left(\frac{1}{27}\right) =\frac{40}{243}\approx0.1646. \]

For one particular labelled sequence, such as success, success, failure, failure, failure, the likelihood is \[ (2/3)^2(1/3)^3=\frac{4}{243}\approx0.01646. \] The count probability is ten times this sequence likelihood. Both use the same parameter-dependent factor; the count probability additionally accounts for all ten sequences represented by the observed count.

What the Binomial Coefficient Does—and Does Not Do

For fixed \(m_j\) and \(y_j\), the factor \({m_j\choose y_j}\) does not depend on \(b\), \(\beta\), or \(\sigma_b^2\). It can therefore be omitted when locating the mode of \(h_j\), or when differentiating \(h_j\) with respect to \(b\). It cannot be omitted from the probability of the count or from the corresponding marginal likelihood value. In particular, likelihood contributions for counts and for one labelled sequence differ by this factor even after integration: it is constant with respect to \(b\), so it remains outside the integral.

If the same observed data are represented consistently and the same model is compared across parameter values, a parameter-independent factor does not change the maximum-likelihood estimates. But likelihood values are not interchangeable across representations unless the constants are handled consistently. The grouped binomial likelihood is the appropriate probability model when the recorded observation is the count.

Mode and curvature: Let \(\hat b_j\) maximize \(h_j(b)\), and define \(H_j=-h_j''(\hat b_j)\). For the model above, \[ h_j'(b)=y_j-m_jp_j(b)-\frac{b}{\sigma_b^2}, \qquad -h_j''(b)=m_jp_j(b)\{1-p_j(b)\}+\frac{1}{\sigma_b^2}. \] The mode solves \(h_j'(\hat b_j)=0\). Since \(-h_j''(b)>0\), \(h_j\) is strictly concave and has at most one mode.

The Laplace approximation replaces \(h_j(b)\) near its mode by its quadratic Taylor approximation. At an interior mode, \(h_j'(\hat b_j)=0\), so that approximation is \(h_j(\hat b_j)-H_j(b-\hat b_j)^2/2\). Integrating the resulting Gaussian-shaped function gives the usual one-dimensional Laplace formula. Keeping the likelihood’s external factors yields:

$$ L_j(\beta,\sigma_b^2) \approx \frac{{m_j\choose y_j}\exp\{h_j(\hat b_j)\}} {\sqrt{\sigma_b^2 H_j}}. $$

This expression shows why the binomial coefficient should be retained in the marginal likelihood even though it has no effect on the conditional mode or curvature. The approximation uses the local height of the integrand and its local width; it is most persuasive when the integrand is concentrated around a smooth, well-defined mode and is reasonably close to a Gaussian there.

Worked Example: Laplace Approximation for Four Trials

Suppose one cluster has \(m_j=4\), \(y_j=3\), \(x_j^\mathsf{T}\beta=0\), and \(\sigma_b^2=1\). Then \(\eta_j(b)=b\), and \[ h_j(b)=3b-4\log\{1+\exp(b)\}-\frac{b^2}{2}. \] Find the mode equation and use a numerical mode near \(0.505\) to calculate the Laplace approximation.

The mode equation is \(3-4p_j(b)-b=0\), with \(p_j(b)=1/\{1+\exp(-b)\}\). At \(b=0.505\), \(p_j(0.505)\approx0.6236\), and the equation’s residual is \(3-4(0.623636)-0.505\approx0.0005\). Thus \(0.505\) is a suitable rounded approximation to the mode. The curvature there is \[ H_j=1+4p_j(0.505)\{1-p_j(0.505)\}\approx1.939. \]

Substituting \(b=0.505\) in the log integrand gives \[ h_j(0.505) =3(0.505)-4\log\{1+\exp(0.505)\}-\frac{(0.505)^2}{2} \approx-2.52128. \] The count coefficient is \({4\choose3}=4\). Since \(\sigma_b^2=1\), the Laplace approximation is \[ L_j\approx4\frac{\exp(-2.52128)}{\sqrt{1.939}} \approx4\frac{0.08036}{1.392} \approx0.231. \] This is an approximation to the marginal probability of observing three successes out of four under the stated random-intercept model and parameter values.

When Counts Can Be Grouped

A single binomial count is a valid representation only when the trials being combined have the same conditional success probability given the cluster effects and model parameters. In the random-intercept model above, that condition holds within cluster when all trials share \(x_j\). If covariates vary between individuals, their probabilities differ even after conditioning on the common intercept; one total success count generally cannot preserve the individual likelihood.

Worked Example: Why Different Predictors Cannot Be Pooled

Consider two trials sharing a random intercept, with \(\beta_0=0\), \(\beta_1=\log 3\), and predictors \(\eta_i(b)=\beta_0+\beta_1x_i+b\). Let the first trial have \(x_1=0\) and be a success, and the second have \(x_2=1\) and be a failure. Evaluate the conditional likelihood at \(b=0\), and compare it with the likelihood obtained by incorrectly treating the trials as having one common probability.

At \(b=0\), the first probability is \(p_1=1/2\). The second is \(p_2=3/(1+3)=3/4\). The correct likelihood for these observations is \[ p_1(1-p_2)=\frac{1}{2}\left(\frac{1}{4}\right)=0.125. \] If the two outcomes are incorrectly pooled as one success in two trials with common probability \(1/2\), the binomial probability would be \[ {2\choose1}(1/2)(1/2)=0.5. \] That differs because the trials do not share a conditional probability. They could instead be grouped separately by predictor pattern: one success among one trial at \(x=0\), and zero successes among one trial at \(x=1\). Their product is \((1/2)(1/4)=0.125\), the correct conditional likelihood.

Diagnostics, Alternatives, and Limitations

Before applying the approximation, check that the data representation matches the model. Within each proposed group, verify that trials share the relevant covariates and the same conditional probability. Confirm that \(0\le y_j\le m_j\), that the random-intercept variance is positive, and that the integral includes the normal density and the count coefficient. A missing normalizing constant changes the marginal likelihood; an omitted binomial coefficient changes the count likelihood.

The strict concavity displayed above is also a useful computational check for this one-dimensional random-intercept integrand: there should be no competing local modes. A root-finding result that does not satisfy \(y_j-m_jp_j(\hat b_j)-\hat b_j/\sigma_b^2\approx0\), or a nonpositive computed \(H_j\), indicates an implementation or numerical error. Even with a correctly found mode, the quadratic approximation can be inaccurate if the integrand is appreciably skewed or spread out. Comparing against adaptive quadrature is a direct alternative when a more accurate numerical integral is needed; the exact integral is the reference target, while Laplace is a local approximation.

The grouped-count form is efficient and exact under its assumptions, but it does not make outcomes marginally independent: integrating over a shared \(b_j\) couples them. Nor does a correct count likelihood guarantee that a Laplace approximation is accurate for every cluster or parameter value. These are separate issues—one concerns the probability model and data grouping, the other the numerical approximation to its integral.

Common pitfall: “The binomial coefficient is constant, so it can be deleted from the whole marginal likelihood.” The correction is that it may be dropped while finding the mode or curvature, but it remains part of the probability of a grouped count and must be included when reporting its likelihood contribution.

Check Your Understanding

Answer each question, then compare with the brief solutions.

  1. For \(m=6\), \(y=2\), and conditional success probability \(p=0.4\), what is the probability of the count? How does it compare with the likelihood of one particular labelled sequence with two successes?
  2. Why does the binomial coefficient not affect the mode of the log integrand with respect to \(b\), but still appear in the marginal likelihood?
  3. State the mode equation and negative second derivative for a cluster with common predictor \(x_j\).
  4. A cluster has two individuals with different covariate vectors. Why might their outcomes not be represented by one binomial count?
  5. Name one diagnostic for a mode calculation and one reason the Laplace approximation might still be inaccurate after the mode is correctly found.

Solutions. (1) The count probability is \({6\choose2}(0.4)^2(0.6)^4=15(0.16)(0.1296)=0.3110\). One particular labelled sequence has likelihood \((0.4)^2(0.6)^4=0.02074\), so the count probability is 15 times larger. (2) The coefficient is constant in \(b\), so it contributes zero to the derivative; it remains a multiplicative factor in the count probability and integral. (3) The equation is \(y_j-m_jp_j(b)-b/\sigma_b^2=0\), and \(-h_j''(b)=m_jp_j(b)\{1-p_j(b)\}+1/\sigma_b^2\). (4) Different covariates can give different conditional probabilities, violating the common-probability condition for one binomial count. (5) Check that the mode equation’s residual is close to zero; even a correct mode can have a skewed or non-Gaussian integrand that a quadratic approximation represents poorly.

Clinical Biostats