Tutorials › Bayesian Clinical Trials › Detecting Multimodality And Poor Mixing

Posterior Computation · Tutorial 134 of 696

Detecting Multimodality And Poor Mixing

Use complementary chain-level diagnostics to distinguish a genuinely multimodal posterior from MCMC chains that have not adequately explored its modes.

Intermediate 11 min read

What You'll Learn

  • Identify evidence of mode trapping in chain-specific trace plots.
  • Compare chain-specific density overlays with pooled posterior densities.
  • Calculate and interpret mode-occupancy proportions across chains.
  • Explain why a plausible pooled mode proportion does not establish adequate exploration.
  • Recognize when marginal plots hide distinct joint posterior modes.
  • Combine visual diagnostics with R-hat and effective sample size without treating any one summary as proof of convergence.

Why Multimodality Needs Chain-Level Diagnostics

A posterior distribution can have several separated regions of high probability. In a clinical trial model, for example, different combinations of treatment effect and baseline risk may fit the observed data similarly. A Markov chain Monte Carlo (MCMC) algorithm can then spend a long time in one region before moving to another. If it rarely moves, the resulting draws may describe only part of the posterior, even when a pooled histogram or a scalar convergence summary looks plausible.

The key diagnostic question is not simply whether the pooled draws have multiple peaks. It is whether each chain explores the relevant regions and moves between them often enough to represent the target posterior. Chain-specific trace plots, density overlays, and mode-occupancy summaries address different parts of that question. They complement the earlier material on trace plots, rank-normalized R-hat, effective sample size, and autocorrelation; none is a stand-alone proof of convergence.

Definition: A multimodal posterior has more than one distinct region of high posterior density. Poor mixing occurs when an MCMC chain explores the target distribution inefficiently, for example by remaining in one such region for long periods or moving between regions too rarely. A mode-occupancy proportion is the fraction of retained draws classified as belonging to a specified posterior region.

A posterior can be multimodal while its chains mix adequately, if they move between modes often enough. Conversely, a chain can mix poorly in a unimodal posterior, such as when it moves slowly along a narrow, correlated ridge. The diagnostics here focus on the special difficulty posed by separated modes, but the same plots can reveal other forms of slow exploration.

Read Traces and Density Overlays by Chain

A trace plot displays successive MCMC draws against iteration. For a scalar parameter, separated horizontal bands, long plateaus, or abrupt jumps between bands can indicate distinct regions of posterior support. Plot chains separately or use clearly distinguishable colors: a pooled trace can hide which chain visited which region. Inspect the parameter of interest and, when relevant, other parameters that may define a joint mode.

A density overlay shows an estimated marginal posterior density for each chain on the same scale. Similar overlays suggest that chains have sampled similar marginal distributions, but they do not establish adequate movement between modes. For example, a chain may spend half its draws in each of two modes but make only a few transitions. Its density can resemble the pooled density while its time series remains strongly dependent. Use the trace and density views together.

The pooled density is useful for seeing the overall shape represented by the saved draws. It is not a substitute for chain-specific overlays: pooling removes chain identity. If one chain samples one mode and another chain samples a different mode, the combined density can look like a coherent two-peaked posterior even though neither chain explored both peaks.

Worked Example: Chains Trapped in Different Modes

Suppose four chains target the posterior for a hypothetical trial’s treatment effect, \(\delta\), measured as a log odds ratio. A trace plot suggests two separated regions, near \(-1.0\) and \(1.0\). After 2,000 retained draws per chain, chain 1 has all 2,000 draws near the first region, chain 2 has all 2,000 near the second, and chains 3 and 4 also remain in just one region each.

Each chain’s density overlay has a single peak, whereas the pooled density has two peaks. The pooled display reveals that the combined draws cover two regions, but the chain-specific displays show that no chain has demonstrated movement between them. If the chains began in dispersed regions, the agreement of the pooled distribution with a plausible two-peak shape is not evidence that the relative posterior mass of those regions has been estimated reliably.

The interpretation is therefore limited: the saved draws suggest two modes, but the run has not established adequate within-chain exploration of both. More iterations from the same chains may not resolve the problem if transitions remain extremely rare. The investigator should investigate the model and sampler, use appropriate dispersed initializations, and assess whether subsequent runs move across the regions.

Define Modes Before Counting Occupancy

A mode-occupancy calculation requires an operational rule for assigning draws to regions. In a clearly separated one-dimensional density, a cut at the low-density valley between peaks may be reasonable. In a multivariate posterior, use a scientifically or computationally meaningful classification of joint regions—for example, combinations of parameters associated with distinct model configurations. State the rule before comparing counts. A threshold placed through a high-density region can make the occupancy result arbitrary.

For chain \(m\), let \(X_{mt}\) be the draw at iteration \(t\), and let \(A\) be a specified posterior region. If \(N_m\) draws are retained, the estimated occupancy is

$$ \hat{\pi}_m(A)=\frac{1}{N_m}\sum_{t=1}^{N_m} I(X_{mt}\in A), $$

where \(I(X_{mt}\in A)\) is 1 when the draw is in \(A\) and 0 otherwise. This proportion is descriptive. It is not, by itself, a measure of how accurately the posterior mass of \(A\) has been estimated.

Worked Example: A Balanced Pooled Occupancy Can Mislead

In four hypothetical chains, each with 1,000 retained draws, classify draws into a left mode \(L\) or a right mode \(R\), using the low-density valley between them. The counts are:

ChainDraws in \(L\)Draws in \(R\)Transitions between regions
1980202
2960404
3309703
4509505

The pooled number of draws in \(L\) is \(980+960+30+50=2{,}020\), out of \(4{,}000\). Thus the pooled occupancy is \(2{,}020/4{,}000=0.505\), or 50.5%. The pooled occupancy in \(R\) is \(1-0.505=0.495\), or 49.5%. Those pooled numbers look nearly balanced.

The chain-specific proportions tell a different diagnostic story. In \(L\), they are \(980/1{,}000=0.98\), \(960/1{,}000=0.96\), \(30/1{,}000=0.03\), and \(50/1{,}000=0.05\). Each chain made only 2 to 5 transitions. Chains 1 and 2 mostly sampled one region; chains 3 and 4 mostly sampled the other. The pooled 50.5% is a numerical summary of these runs, not evidence that they adequately estimated the posterior mass of either mode. Chain-level R-hat may flag this kind of between-chain difference, but the occupancy table makes the mode-specific behavior explicit.

Why Occupancy Depends on Movement

The reason occupancy proportions can be useful—and misleading—is apparent from a short justification. Suppose a chain is stationary for its target posterior, and let \(\pi(A)\) denote that posterior’s probability for region \(A\). Define \(I_t=I(X_t\in A)\). Stationarity gives \(E(I_t)=\pi(A)\). Therefore, for \(N\) draws,

$$ E\left(\frac{1}{N}\sum_{t=1}^{N} I_t\right) =\frac{1}{N}\sum_{t=1}^{N}E(I_t) =\frac{1}{N}\sum_{t=1}^{N}\pi(A) =\pi(A). $$

This establishes the occupancy proportion as an unbiased average under those conditions; it does not show that a finite run is precise. Consecutive MCMC draws are dependent. If \(\gamma_k=\operatorname{Cov}(I_t,I_{t+k})\) for a stationary chain, then

$$ \operatorname{Var}\left(\frac{1}{N}\sum_{t=1}^{N} I_t\right) =\frac{1}{N^2}\left[N\gamma_0+ 2\sum_{k=1}^{N-1}(N-k)\gamma_k\right]. $$

When mode membership persists for long periods, the covariances can remain positive over many lags, making the variance much larger than the independent-draw calculation would suggest. If a chain never reaches a mode, or is not sampling its stationary distribution, the stationarity argument does not justify interpreting its observed occupancy as a reliable estimate of \(\pi(A)\).

Worked Example: Similar Occupancies, Few Transitions

Consider four hypothetical chains with 1,000 draws each. In every chain, 500 draws are classified in \(L\) and 500 in \(R\), so each chain’s occupancy is \(500/1{,}000=0.50\). Suppose, however, that each trace contains only four transitions between regions, with long stretches spent in one mode.

The matching 50% occupancies and similar chain-specific density overlays are reassuring in one limited sense: each chain’s saved draws include both regions in similar proportions. They do not show frequent movement. A chain’s mode indicator remains unchanged for long blocks, so consecutive indicators are strongly related and the occupancy estimate has much less information than 1,000 independent classifications would provide.

This pattern illustrates why a pooled summary or even similar per-chain summaries cannot certify good mixing. Look at transition counts and their timing in the trace, and consider whether independent runs with varied initial values reach and move between the same regions. A small number of transitions is a warning, not a universal numerical cutoff: what counts as adequate depends on the posterior, the quantity being estimated, and the precision required.

Marginal Plots Can Hide Joint Modes

A density overlay for one parameter is a marginal diagnostic: it displays that parameter while averaging over the others. Distinct joint modes can overlap in a marginal distribution, making that parameter’s density appear unimodal. Conversely, an apparently multimodal marginal can arise from different configurations of other parameters, not from isolated peaks that can be understood one parameter at a time. When the model has strongly related parameters, inspect paired draws, relevant transformations, or a joint mode classification as well as individual traces.

Worked Example: Two Joint Modes With Unimodal Marginals

In a hypothetical trial model, suppose joint posterior draws for treatment effect \(\delta\) and a nuisance parameter \(\eta\) form two clusters, one near \((\delta,\eta)=(0.5,2.0)\) and one near \((\delta,\eta)=(2.0,0.5)\). Assume, for illustration, that the clusters have similar posterior mass and modest within-cluster spread.

The marginal distribution of \(\delta\) may show peaks near 0.5 and 2.0, as may the marginal distribution of \(\eta\). But if the clusters overlap substantially along either coordinate, either marginal could look like one broad peak. A paired plot of \(\delta\) against \(\eta\) can reveal the two joint clusters and their relationship.

A diagnostic based only on whether the marginal trace of \(\delta\) visits low and high values could therefore miss that the sampler never visits one of the joint configurations. Define the regions using the pair \((\delta,\eta)\), then compare chain-specific plots and joint mode occupancy. This example is hypothetical; it illustrates why marginal agreement does not establish exploration of a joint posterior.

Combine Diagnostics, and Recognize Their Limits

Use several diagnostics because each can miss a different failure. Trace plots show temporal behavior; density overlays compare marginal shapes by chain; occupancy tables summarize visits to prespecified regions; rank-normalized R-hat compares chains; and effective sample size describes information in correlated draws for particular summaries. R-hat and effective sample size were introduced earlier in the course, so the relevant point here is their role: they add useful evidence, but a satisfactory value does not certify that all modes were found or crossed.

Interpret apparent warnings in context. A chain-specific density difference or a large occupancy discrepancy is evidence to investigate, not automatic proof that the posterior is multimodal. The chosen region boundary, finite run length, and ordinary simulation variation matter. Likewise, similar densities do not prove mixing: chains can have similar proportions but few transitions, or all chains can miss the same unvisited mode if they share the same starting region or failure to explore.

A practical review should ask whether initial values covered plausible separated regions, whether each chain visited those regions, whether transitions occurred repeatedly rather than as a single early jump, and whether chain-specific distributions and summaries agree. If evidence remains weak, longer runs alone may not be enough. Reassess the parameterization, model geometry, and sampling strategy, then run and inspect new chains. No visual diagnostic identifies the correct posterior if the target model itself is misspecified.

A common mistake is to argue, “The pooled density has both peaks and the pooled occupancy is close to 50–50, so the modes were sampled well.” Pooling can combine chains that stayed in different modes, and the same occupancy can arise from many transitions or just a few long visits. The correction is to retain chain identity, inspect time ordering and transition counts, and treat occupancy as a trustworthy posterior-mass estimate only when the sampling behavior supports that interpretation.

Key takeaway: Multimodality is a feature of the posterior; poor mixing is a feature of how the chains explore it. Diagnose the two together by examining chain-specific traces, density overlays, and mode occupancy, then interpret these alongside—not instead of—R-hat and effective sample size.

Check Your Understanding

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

  1. Two chains have very different mode-occupancy proportions, but their pooled density has two clear peaks. What does the pooled density fail to show?
  2. What is the estimated occupancy of region \(A\) if a chain has 360 of 900 retained draws in \(A\)? What additional information is needed to judge mixing?
  3. All chains have similar occupancy proportions, but each makes very few transitions. Why is that not sufficient evidence of adequate exploration?
  4. Why might a marginal density overlay fail to reveal two distinct joint posterior modes?

Solutions. (1) It removes chain identity, so it does not show whether individual chains visited both peaks or different chains stayed in different modes. (2) The occupancy is \(360/900=0.40\), or 40%. Inspect chain-specific traces, transition frequency and timing, and agreement across independently initialized chains. (3) Similar proportions can be produced by long blocks in each mode; few transitions indicate persistent mode membership and strong dependence, so the finite-run occupancy may be imprecise. (4) Marginalization averages over other parameters, and distinct joint clusters can overlap when projected onto one parameter, producing an apparently single-peaked marginal.

Clinical Biostats