Tutorials › Stochastic Processes › Diagnosing Multimodality and Poor Mixing

Markov Chain Monte Carlo · Tutorial 933 of 994

Diagnosing Multimodality and Poor Mixing

Use mode-aware, between-chain diagnostics to distinguish local stability from exploration of the full target distribution.

Advanced 10 min read

What You'll Learn

  • Define mode occupancy and compare it across chains with the target’s mode probabilities.
  • Read trace plots for evidence of long periods without transitions between modes.
  • Use deliberately different starting modes to expose chains that remain separated.
  • Recognize how a pooled average can look correct even when no chain explores the full target.
  • Interpret diagnostics as evidence about a run, not proof of convergence.

Why Multimodality Needs Special Attention

A Markov chain can move regularly within one region of a target distribution while rarely reaching another region that also has substantial probability. Its trace may look stable, and summaries computed within that region may seem plausible. Yet the run may not represent the full target. This is a central diagnostic problem in multimodal Markov chain Monte Carlo (MCMC): local stability is not the same as adequate exploration across modes.

Assume the MCMC output is a Markov chain \((X_n)_{n\ge0}\) on a probability space \((\Omega,\mathcal{F},\mathbb{P})\), with state space \(S\), transition kernel \(P\), and target distribution \(\pi\). When \(S\) is finite, write \(P=(p_{ij})\), where \(p_{ij}=\mathbb{P}(X_{n+1}=j\mid X_n=i)\). The filtration is \(\mathcal{F}_n=\sigma(X_0,\ldots,X_n)\). In general state spaces, the same diagnostic ideas apply to measurable regions of the state space. We take the target to be invariant for the chain; invariance means that a chain distributed as \(\pi\) at time \(n\) is also distributed as \(\pi\) at time \(n+1\).

Definition: For this tutorial, a mode is a region \(A\) of the state space that captures a distinct concentration of target probability. To compare modes using counts, specify disjoint regions \(A_1,\ldots,A_K\) in advance, with their union covering the part of the state space being diagnosed. The occupancy of mode \(A_k\) in a run of \(N\) recorded states is \(\widehat{\pi}_N(A_k)=\frac{1}{N}\sum_{n=0}^{N-1}\mathbf{1}_{\{X_n\in A_k\}}\). Assign boundary points consistently so that every recorded state belongs to exactly one region.

Mode definitions are diagnostic choices, not universal mathematical objects: a continuous target need not come with a canonical partition into modes. A trace plot records sampled values against iteration and can show long plateaus or abrupt jumps. For a multimodal target, it is often useful to plot a mode label as well as parameters of interest. Compare the amount of time spent in each mode separately for each chain, then compare those amounts with the mode probabilities implied by the target, if those probabilities are known or can be computed.

Between-chain comparisons add a different kind of evidence. Run chains from starting points in distinct plausible modes and examine whether their traces, mode occupancies, and summaries become compatible. This is not a demand that chains look identical at every iteration. It is a check for persistent separation that might signal missed exploration. Rank-normalized R-hat and other summaries from earlier material can help compare chains, but no single scalar diagnostic establishes that all relevant modes have been explored.

Two Facts That Clarify What Occupancy Can Tell You

Proposition (Expected occupancy under stationarity): If \(X_0,\ldots,X_{N-1}\) each have distribution \(\pi\), then for any measurable region \(A\), \(\mathbb{E}[\widehat{\pi}_N(A)]=\pi(A)\). This statement does not require the states to be independent.

Proof. By the definition of occupancy, linearity of expectation, and the fact that each \(X_n\) has distribution \(\pi\),

$$ \mathbb{E}[\widehat{\pi}_N(A)] =\frac{1}{N}\sum_{n=0}^{N-1}\mathbb{E}[\mathbf{1}_{\{X_n\in A\}}] =\frac{1}{N}\sum_{n=0}^{N-1}\mathbb{P}(X_n\in A) =\frac{1}{N}\sum_{n=0}^{N-1}\pi(A) =\pi(A). $$

This proves the proposition. It is an expectation identity, not a guarantee that a particular finite run has occupancy close to \(\pi(A)\). In particular, it gives no independence claim and no small-variance claim. \(\square\)

Proposition (A pooled mean can conceal separated chains): Let the target assign probability \(1/2\) to each of the two states \(-1\) and \(+1\). If one chain consists entirely of recorded values \(-1\) and a second consists entirely of recorded values \(+1\), their equally weighted pooled mean is the target mean \(0\), even though neither chain visits both states.

Proof. The target mean is \((1/2)(-1)+(1/2)(+1)=0\). If each of the two chains has \(N\) recorded values, their pooled mean is \(\big(N(-1)+N(+1)\big)/(2N)=0\). However, the first chain’s occupancy of \(\{+1\}\) is \(0\), and the second chain’s occupancy of \(\{+1\}\) is \(1\). Thus agreement of the pooled mean with the target mean does not imply that either chain explored both states. \(\square\)

Worked Diagnostic Examples

Worked Example: Long Traces in Two Modes

Consider a chain on \(S=\{-1,+1\}\), defined on a probability space \((\Omega,\mathcal{F},\mathbb{P})\), with \(\mathcal{F}_n=\sigma(X_0,\ldots,X_n)\) and transition matrix

$$ P= \begin{bmatrix} \tfrac{99}{100} & \tfrac{1}{100}\\ \tfrac{1}{100} & \tfrac{99}{100} \end{bmatrix}. $$

Both row sums are \(\tfrac{99}{100}+\tfrac{1}{100}=1\). The target \(\pi=(\tfrac12,\tfrac12)\) is invariant: its probability of moving to \(-1\) is \(\tfrac12\cdot\tfrac{99}{100}+\tfrac12\cdot\tfrac{1}{100}=\tfrac12\), and its probability of moving to \(+1\) is also \(\tfrac12\). The two states are the two modes in this example.

Suppose two runs each record 12 states. The first run records \(-1\) at every iteration, and the second records \(+1\) at every iteration. These are possible paths. Each path has 11 transitions that stay in its initial state, so its probability conditional on that initial state is \((\tfrac{99}{100})^{11}\). In the first run, the observed occupancy of \(\{+1\}\) is \(0/12=0\); in the second it is \(12/12=1\), while the target probability is \(1/2\).

Interpretation. The trace in each run is constant, which might look like stability if examined without the state label or other chains. Here it instead signals that the two runs have not crossed between modes. A zero observed transition count is evidence to investigate, not proof that the transition probability is zero: the chain’s specified probability of switching is \(1/100\). This finite output does not show whether the run has explored the target adequately.

Worked Example: Unequal Target Masses and Per-Chain Occupancy

Let \(S=\{A,B\}\), with a chain on a probability space \((\Omega,\mathcal{F},\mathbb{P})\) and filtration \(\mathcal{F}_n=\sigma(X_0,\ldots,X_n)\). Use the transition matrix

$$ P= \begin{bmatrix} \tfrac{99}{100} & \tfrac{1}{100}\\ \tfrac{1}{300} & \tfrac{299}{300} \end{bmatrix}. $$

The first row sums to \(\tfrac{99}{100}+\tfrac{1}{100}=1\), and the second sums to \(\tfrac{1}{300}+\tfrac{299}{300}=1\). The proposed target is \(\pi=(\tfrac14,\tfrac34)\). Check invariance directly: the probability assigned to \(A\) after one transition is \(\tfrac14\cdot\tfrac{99}{100}+\tfrac34\cdot\tfrac{1}{300}=\tfrac{99}{400}+\tfrac{1}{400}=\tfrac14\). The probability assigned to \(B\) is \(\tfrac14\cdot\tfrac{1}{100}+\tfrac34\cdot\tfrac{299}{300}=\tfrac{1}{400}+\tfrac{299}{400}=\tfrac34\). The entries of \(\pi\) sum to \(1\), so this is a probability distribution and is invariant.

For illustration, consider two possible runs of eight recorded states each: the first is \(A,A,A,A,B,B,B,B\), and the second is \(B,B,B,B,B,B,B,A\). Every stated move has positive probability under \(P\). The first run has four visits to \(A\), hence occupancy \(4/8=1/2\); the second has one visit to \(A\), hence occupancy \(1/8\). Pooling the two runs gives \(5\) visits to \(A\) among \(16\) recorded states, or \(5/16\). The target probability is \(1/4=4/16\), so the pooled estimate differs from the target by \(5/16-4/16=1/16\).

Interpretation. The chain has a small probability of leaving either state on any given step: \(1/100\) from \(A\) and \(1/300\) from \(B\). Short traces can therefore spend very different amounts of time in the two modes. Report occupancy by chain as well as pooled occupancy, and compare each with the target probabilities when known. In this example, the discrepancy is descriptive evidence of a short, uneven run; it does not by itself quantify the accuracy of a longer-run estimate.

Worked Example: A Correct Pooled Mean with No Mode Crossing

Use the symmetric chain on \(\{-1,+1\}\) from the first example, with target \(\pi=(\tfrac12,\tfrac12)\). Suppose two chains each produce six recorded values. The first records \(-1\) six times; the second records \(+1\) six times. The target mean is \(\tfrac12(-1)+\tfrac12(+1)=0\). The pooled sample mean is \(\big(6(-1)+6(+1)\big)/12=0\), exactly the target mean.

Yet the first chain’s mode occupancy for \(\{+1\}\) is \(0/6=0\), and the second chain’s is \(6/6=1\). Neither chain has recorded a crossing. Under the transition matrix in the first example, each constant six-state path has five self-transitions and conditional probability \((\tfrac{99}{100})^5\), which is positive. Thus the apparently correct pooled mean is compatible with runs separated by mode.

Interpretation. A pooled statistic can cancel errors across chains. That cancellation may be useful algebraically, but it is not evidence that either chain has sampled the full target. Inspect chain-specific traces and occupancies before interpreting pooled summaries.

Putting the Diagnostics Together

A useful mode-aware review combines several views of the same output. First, plot relevant scalar parameters against iteration, and plot a mode label or region indicator when a meaningful partition is available. A trace that remains in one region for a long interval, especially across several chains, warrants investigation. Second, calculate the fraction of recorded states in each mode separately for each chain. Compare these fractions across chains and with target mode probabilities when known. Third, record transitions between modes: a run with no observed crossing provides little direct evidence about relative mode mass, even if its within-mode trace looks smooth.

These diagnostics have limits. A transition between two chosen regions does not prove that every part of either region has been explored. Conversely, a partition that merges distinct concentrations can hide failures. Trace plots depend on what is plotted, and occupancy estimates can be highly variable when successive states are strongly dependent. The expectation proposition above does not remove this dependence or promise reliable finite-run frequencies.

Diagnostic viewQuestion it helps answerWarning sign
Parameter and mode-label tracesDoes the run move between distinct regions?Long plateaus or chains in separate regions
Per-chain mode occupancyDo chains spend comparable fractions in each region?Large differences between chains or from known target masses
Between-chain summariesAre chains giving compatible results?Persistent separation hidden by a pooled average
Observed mode transitionsHas the output recorded movement across regions?No crossings, especially with long within-mode traces

Common mistake. For the two six-state chains in the third example, one might calculate the pooled mean \(0\) and conclude that the chains represent the symmetric target. The arithmetic is correct, but the conclusion is not justified: the first chain’s occupancy of \(\{+1\}\) is \(0\), and the second’s is \(1\), rather than either chain showing the target occupancy \(1/2\). The correction is to inspect chain-specific traces and mode occupancies alongside pooled summaries. A reassuring average does not establish exploration of the full target.

Multimodality diagnosis is therefore a comparison exercise: compare within-chain movement with between-chain agreement, and compare observed occupancy with target mass when it is available. Stable behavior inside one mode can be useful evidence about that region, but it cannot by itself establish that the simulation has represented all modes. These are diagnostic signals for assessing a run, not finite-sample proofs of convergence.

Check Your Understanding

Use the definitions and examples above to answer each question.

  1. For the symmetric two-state chain, what are the target and observed probabilities of \(\{+1\}\) in each of the two constant 12-state runs?
  2. In the unequal-mass example, verify that the pooled occupancy \(5/16\) differs from the target mass \(1/4\) by \(1/16\).
  3. Why does the expected-occupancy proposition not imply that a particular finite run has occupancy close to the target probability?
  4. Give an example of how a pooled summary can conceal differences between chains, even when the pooled value matches the target summary.
  5. Name two pieces of mode-aware output you would inspect before interpreting a trace that appears stable within one region.