Tutorials › Generalized Linear Mixed Models (GLMM) › Prior Sensitivity Under Separation

Separation in Binary Outcomes · Tutorial 340 of 698

Prior Sensitivity Under Separation

You will learn a systematic way to vary a separated coefficient’s prior scale while holding the rest of the GLMM fixed, then interpret changes in posterior estimates and predictions.

Advanced 12 min read

What You'll Learn

  • Specify a sensitivity comparison that changes one fixed-effect prior scale at a time.
  • Explain why a proper prior yields a finite posterior even when the likelihood has a separating direction.
  • Calculate how prior scale changes a separated coefficient’s posterior mode in a simple conditional example.
  • Compare posterior coefficients and predictions across prior scales in a hypothetical binary GLMM.
  • Distinguish cluster-specific predictions from predictions averaged over random effects.
  • Diagnose prior sensitivity without confusing it with convergence failure or evidence that one prior is correct.

Why Prior Scale Matters Under Separation

With separation, the binary-outcome likelihood can keep improving as a fixed-effect coefficient grows in magnitude. A proper prior can make the posterior well-defined, but it does not make the resulting estimate independent of the prior. The prior’s scale determines how much posterior probability can extend into the large-coefficient region that the likelihood alone does not adequately constrain.

This tutorial focuses on assessing that dependence systematically. The aim is not to select whichever prior produces a preferred estimate. Instead, compare a prespecified set of plausible prior scales, keep the other model assumptions fixed, and report whether the coefficient and relevant predictions are materially affected. A stable prediction can coexist with a noticeably changing coefficient, and the reverse can occur for particular covariate patterns.

Definition: A prior sensitivity comparison for a separated fixed effect is a set of posterior analyses in which the prior scale for that effect is varied over a substantively defensible range while the observed data, likelihood, covariate coding, other priors, and computational procedure are held fixed. The comparison examines how posterior summaries and predictions change across those analyses.

Model, Assumptions, and What Is Varied

For binary observations \(Y_{ij}\) in cluster \(j\), consider a logistic random-intercept model:

$$ Y_{ij}\mid b_j \sim \operatorname{Bernoulli}(p_{ij}),\qquad \operatorname{logit}(p_{ij})=\beta_0+\beta_1 x_{ij}+b_j,\qquad b_j\sim N(0,\tau^2). $$

Here \(i\) indexes observations within cluster \(j\), \(x_{ij}\) is a fixed-effect predictor, \(\beta_0\) is the fixed intercept, \(\beta_1\) is the coefficient under study, and \(b_j\) is the cluster-specific random intercept. Conditional on the random effects and covariates, the responses are assumed independent Bernoulli variables. The random effects are assumed independent across clusters and normally distributed with mean zero and variance \(\tau^2\). These are model assumptions, not consequences of separation.

For a focused comparison, suppose the priors are \(\beta_1\sim N(0,s^2)\) and \(\beta_0\sim N(0,2^2)\), with a fixed, specified value of \(\tau\). Compare several values of \(s\), changing no other part of the analysis. A zero-centered prior is appropriate only if zero is a defensible prior center under the chosen coding; in another application a different center may be warranted. The scale \(s\) is measured in coefficient units, so it must be interpreted in relation to the units and coding of \(x_{ij}\).

A meaningful comparison also requires the same outcome definition, observations, link, design matrix, contrasts, and random-effects specification in every fit. If a predictor is rescaled or a factor contrast is changed between fits, the numerical prior scales no longer describe the same prior information. If \(\tau\) is estimated rather than fixed, use the same prior for \(\tau\) in every fit and make clear that the comparison varies only the prior scale for \(\beta_1\).

Why a Proper Prior Produces a Finite Posterior

A simple conditional calculation shows the mechanism. Suppose the likelihood contribution along a separating coefficient direction is \(n\) successes at \(x=1\), with the linear predictor \(\beta\); for this calculation, hold all other linear-predictor terms at zero. The likelihood is \(L(\beta)=\{e^\beta/(1+e^\beta)\}^n\). It approaches one as \(\beta\) tends to positive infinity, so it does not penalize arbitrarily large positive coefficients enough to give a finite maximum-likelihood estimate. Put a proper prior \(N(0,s^2)\) on \(\beta\). Ignoring constants, the log posterior is

$$ \ell(\beta\mid y) = n\left[\beta-\log(1+e^\beta)\right]-\frac{\beta^2}{2s^2}. $$

The prior density integrates to one, and the likelihood is bounded above by one. Therefore the posterior normalizing integral is finite and positive. Differentiating the log posterior gives

$$ \frac{d\ell}{d\beta} =\frac{n}{1+e^\beta}-\frac{\beta}{s^2}. $$

At the posterior mode, set the derivative to zero. Rearranging gives

$$ \beta(1+e^\beta)=n s^2. $$

The left side is strictly increasing for \(\beta\geq 0\), since its derivative is \(1+e^\beta+\beta e^\beta>0\), so there is a unique positive solution for \(n s^2>0\). Increasing \(s\) increases the right side and hence the mode. This one-dimensional calculation is a conditional slice, not a substitute for fitting and integrating a GLMM. In a GLMM, the random effects and other coefficients also contribute to the posterior.

Worked Example: The Prior Scale Changes a Separated Mode

In the conditional calculation above, let \(n=10\). Compare \(s=1\) with \(s=5\). The mode equation is \(\beta(1+e^\beta)=10s^2\).

For \(s=1\), the equation is \(\beta(1+e^\beta)=10\). At \(\beta=1.6335\), \(e^\beta\approx5.1218\), so \(1+e^\beta\approx6.1218\) and \(1.6335(6.1218)\approx10.00\). Thus the mode is approximately \(1.6335\). The corresponding conditional success probability is \(1/(1+e^{-1.6335})\approx0.837\).

For \(s=5\), the equation is \(\beta(1+e^\beta)=10(5^2)=250\). At \(\beta=4.095\), \(e^\beta\approx60.04\), so \(1+e^\beta\approx61.04\) and \(4.095(61.04)\approx250.0\). Thus the mode is approximately \(4.095\), and the corresponding conditional probability is \(1/(1+e^{-4.095})\approx0.984\).

The larger prior scale allows a much larger coefficient and a probability closer to one. These are modes and probabilities in the stated conditional slice; they are not posterior means or population-averaged probabilities from a fitted mixed model.

A Systematic Comparison in a Binary GLMM

A practical comparison starts with scales chosen before interpreting the resulting estimates. For example, use a narrow, a moderate, and a broad scale that are all plausible for the predictor’s units. Fit each model with the same data and remaining assumptions. For each fit, examine the posterior distribution of the separated coefficient, not only a single point estimate, and calculate predictions for scientifically relevant covariate patterns.

1
Fix the model and coding.
Record the link, fixed effects, contrasts, random-effects structure, and all priors other than the scale being examined.
2
Choose a scale grid.
Choose several defensible values of \(s\), in the units of \(\beta_1\). Do not use an extreme scale merely to force a desired answer.
3
Check computation and posterior shape.
For every fit, check sampling or integration diagnostics, effective sample sizes where relevant, and whether posterior tails are adequately explored.
4
Compare coefficients and predictions.
Report comparable posterior summaries and intervals, then compare predictions for the same covariate values and the same definition of random effects.
5
Describe dependence on the prior.
State which conclusions remain similar and which change meaningfully across plausible scales. Do not present one scale as objectively correct merely because it gives a more convenient result.

Worked Example: Comparing Three Scales in a Separated Dataset

Consider a hypothetical study with three clusters. In each cluster, one observation with \(x=0\) has \(y=0\), and one with \(x=1\) has \(y=1\). Thus all three outcomes at \(x=0\) are zero and all three at \(x=1\) are one: the predictor separates the outcomes. Fit the random-intercept logistic model above, with \(\tau=0.6\), \(\beta_0\sim N(0,2^2)\), and \(\beta_1\sim N(0,s^2)\). The following are deliberately hypothetical numerical posterior summaries from the same numerical integration procedure, included to illustrate how results should be compared; they are not observations from a real study.

Prior scale \(s\)Posterior median of \(\beta_1\)Illustrative 95% posterior intervalMarginal prediction at \(x=0\)Marginal prediction at \(x=1\)
0.50.78(0.03, 1.59)0.400.60
11.20(0.08, 2.67)0.350.65
21.45(0.09, 3.55)0.320.68

The posterior median rises from \(0.78\) to \(1.45\) as the prior scale increases from \(0.5\) to \(2\), and the intervals widen. The marginal predicted probability at \(x=1\) changes from \(0.60\) to \(0.68\), while the prediction at \(x=0\) changes from \(0.40\) to \(0.32\). The displayed predictions sum to one at each scale in this hypothetical table, but this equality is not guaranteed by the stated model. This example suggests that the coefficient magnitude and uncertainty are prior-sensitive; the predictions move less, but they are not unchanged. The values are conditional on the stated model and hypothetical calculation, not universal effects of these prior scales.

An interval here is a posterior credible interval: under the specified model and priors, it contains 95% of the posterior probability for the parameter. It is not a guarantee that the unknown coefficient has a 95% chance of lying in that particular computed interval under repeated sampling.

Predictions: Conditional and Population-Averaged

Prior sensitivity should be assessed on the prediction scale as well as the coefficient scale. For a specified cluster effect \(b_j\), a cluster-specific probability is \(\operatorname{logit}^{-1}(\beta_0+\beta_1x+b_j)\). A population-averaged probability for a new cluster averages over the random-effect distribution as well as the posterior uncertainty in the parameters:

$$ P(Y_{\mathrm{new}}=1\mid x,\text{data}) = \int \operatorname{logit}^{-1}(\beta_0+\beta_1x+b) \,p(\beta_0,\beta_1,b\mid\text{data})\, d\beta_0\,d\beta_1\,db. $$

The definition of prediction must be held constant across prior scales. A prediction at \(b=0\) describes a cluster with its random intercept set to zero; it is not generally the same as averaging over new clusters. Also, because the inverse-logit function is nonlinear, applying it to posterior mean coefficients generally does not equal averaging the probabilities over posterior draws.

Worked Example: Integrating Over a Random Intercept

For a transparent plug-in illustration, fix \(\beta_0=-0.9\), \(\beta_1=1.8\), and \(\tau=0.6\). Approximate \(b\sim N(0,0.6^2)\) with the three-point rule assigning weights \(1/6, 2/3, 1/6\) to \(b=-\sqrt{3}(0.6),0,\sqrt{3}(0.6)\). These points are approximately \(-1.039,0,1.039\).

At \(x=0\), the linear predictors are \(-1.939,-0.900,0.139\), giving inverse-logit probabilities approximately \(0.126,0.289,0.535\). The weighted average is

$$ \frac{1}{6}(0.126)+\frac{2}{3}(0.289)+\frac{1}{6}(0.535) =0.303. $$

At \(x=1\), the linear predictors are \(-0.139,0.900,1.939\), with probabilities approximately \(0.465,0.711,0.874\). The same weighted calculation gives

$$ \frac{1}{6}(0.465)+\frac{2}{3}(0.711)+\frac{1}{6}(0.874) =0.697. $$

By contrast, setting \(b=0\) gives probabilities \(\operatorname{logit}^{-1}(-0.9)\approx0.289\) at \(x=0\) and \(\operatorname{logit}^{-1}(0.9)\approx0.711\) at \(x=1\). The difference illustrates why the prediction target matters. This is a fixed-parameter quadrature illustration, not a full posterior prediction; in an actual sensitivity comparison, average over posterior draws and use sufficiently accurate numerical integration.

Diagnostics, Alternatives, and Limitations

Useful sensitivity diagnostics include plotting posterior densities or intervals for the separated coefficient across scales, checking whether posterior mass remains near the prior boundary or in long tails, and tabulating predictions for important covariate patterns. Compare not just medians but also uncertainty and scientifically relevant contrasts. If a coefficient changes substantially while predictions barely change over the observed covariate range, report both facts rather than declaring the analysis wholly stable.

Separate prior sensitivity from computational failure. Poor mixing, divergent transitions, low effective sample sizes, or unstable numerical integration can make posterior summaries unreliable for every scale. Resolve those problems before interpreting differences between fits. Conversely, good convergence does not establish that the prior is unimportant; a well-computed posterior can remain strongly prior-sensitive.

The main alternative is to report an ordinary likelihood-based estimate when it exists and is stable. Under separation, however, the maximum-likelihood estimate in the separating direction may not be finite, so it cannot provide a comparable finite coefficient. Penalized methods, including Firth correction and ridge penalization, are other approaches, but they define different inferential procedures and should not be treated as interchangeable with Bayesian prior-scale sensitivity. The purpose here is to expose dependence on a stated prior, not to establish that a Bayesian fit is always preferable.

A sensitivity grid cannot repair a misspecified link, an unsuitable random-effects distribution, dependence not represented by the model, or an uninformative design. Nor does it determine which prior is substantively justified. Prior scales need interpretation on the chosen predictor scale, and a coefficient prior that seems broad on one coding may be implausibly broad on another. If plausible scales yield materially different scientific conclusions, that dependence is itself an important result to report.

Common pitfall: “The prior is proper, so the separated estimate is now objective and no longer depends on assumptions.” A proper prior makes the posterior finite under the stated model; it does not eliminate prior influence. The correction is to compare defensible scales, examine posterior uncertainty and relevant predictions, and describe which conclusions depend on the chosen scale.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. If the prior for a separated coefficient changes from \(N(0,1^2)\) to \(N(0,3^2)\), what must remain fixed for this to be a focused sensitivity comparison?
  2. In the conditional example with \(n=10\), what mode equation results when \(s=2\), and should its positive root be larger or smaller than the root for \(s=1\)?
  3. Why can a prediction for \(b=0\) differ from the probability averaged over new clusters?
  4. What does a 95% posterior credible interval mean in the prior-scale comparison?
  5. If coefficient summaries change across scales but the predictions of interest change very little, what should be reported?

Solutions. (1) Keep the data, model, coding, random-effects assumptions, other priors, and computational method fixed; change only the stated prior scale. (2) The equation is \(\beta(1+e^\beta)=10(2^2)=40\). Since the left side is strictly increasing for positive \(\beta\), its root is larger than the root for right side 10. (3) The first sets the random effect to zero; the second averages the nonlinear inverse-logit probability over the random-effect distribution, so they are generally unequal. (4) Conditional on the specified model and prior, 95% of the posterior probability lies in the interval; it is not a repeated-sampling guarantee or a probability statement about whether the model is true. (5) Report both the coefficient sensitivity and the relative stability of the relevant predictions, including the prior scales and prediction target, rather than treating either result as a complete summary.

Clinical Biostats