Tutorials › Bayesian Clinical Trials › Warmup, Initialization, And Chain Separation

Posterior Computation · Tutorial 129 of 696

Warmup, Initialization, And Chain Separation

Set up independent, dispersed MCMC chains; distinguish warmup from retained draws; and interpret cross-chain agreement without treating it as proof of convergence.

Intermediate 12 min read

What You'll Learn

  • Choose valid, meaningfully dispersed initial values for multiple chains targeting the same posterior.
  • Distinguish warmup adaptation from the retained sampling phase.
  • Calculate which iterations are discarded and how many draws remain.
  • Explain why chains that agree from different starts provide useful diagnostic evidence.
  • Recognize why agreement alone cannot establish convergence or rule out shared failure.

Why Initialization and Warmup Matter

MCMC output depends on how a simulation is started and how its transitions are tuned. A chain initialized in an unrepresentative part of the parameter space may take time to reach regions with substantial posterior probability. Meanwhile, adapting a proposal scale or an algorithm’s tuning parameters changes the transition mechanism. These issues motivate two separate tasks: choose multiple starting states that probe different plausible regions, and distinguish the tuning period from the draws used for posterior summaries.

Suppose the trial data are \(y\), the model parameters are \(\theta\), and the target posterior density is \(\pi(\theta\mid y)\). Chain \(m\) has state \(\theta_{m,t}\) at iteration \(t\). Each chain should target the same posterior, but use a distinct initial state and an independent random-number stream. Within a chain, successive states are generally dependent; “independent chains” means that their random-number streams and simulation histories are separate, not that every draw is independent of every other draw.

Definition: Initialization is the choice of each chain’s initial state, \(\theta_{m,0}\). Warmup is an initial set of iterations used to let the chain move away from its starting point and, in adaptive algorithms, to tune computational settings. Retained draws are the subsequent iterations used to estimate posterior quantities. Warmup draws are ordinarily excluded from those estimates.

Choosing and Separating Initial States

Every initial state must satisfy the model’s constraints and be a valid input to the transition algorithm. For example, a probability parameter must be between 0 and 1, and a positive scale parameter must be greater than zero. If a constrained parameter is represented by an unconstrained transformed parameter, initialize the sampler on the scale it actually uses and check that the implied parameter is valid.

Use starting values that are meaningfully different across chains, while still being computationally valid. This is often called overdispersed initialization: the starts cover a wider range than a cluster of nearly identical values. They need not be absurd or so extreme that numerical computations fail. The point is to make it less likely that every chain begins in the same narrow region and therefore gives the same misleading impression.

For a logistic trial model, for instance, one might initialize the baseline log-odds and treatment log-odds contrast so that some chains imply a lower response probability in the treatment arm and others imply a higher one. This is a deliberate exploration of different starting locations, not a claim that those locations are equally plausible under the posterior.

Worked Example: Initializing a Two-Arm Logistic Model

Consider a hypothetical binary-endpoint trial model with control response probability \(p_0\) and treatment response probability \(p_1\). Write the baseline log-odds as \(\alpha=\operatorname{logit}(p_0)\), and the treatment log-odds contrast as \(\beta=\operatorname{logit}(p_1)-\operatorname{logit}(p_0)\), where \(\operatorname{logit}(p)=\log\{p/(1-p)\}\). Construct two valid, dispersed starting states.

For chain 1, choose \(p_0=0.15\) and \(p_1=0.70\). Then \(\alpha=\log(0.15/0.85)=\log(0.1765)\approx-1.735\), and \(\beta=\log(0.70/0.30)-\log(0.15/0.85)=0.8473-(-1.735)=2.582\). Thus its starting state is approximately \((\alpha,\beta)=(-1.735,2.582)\).

For chain 2, choose \(p_0=0.75\) and \(p_1=0.25\). Then \(\alpha=\log(0.75/0.25)=\log(3)\approx1.099\), and \(\beta=\log(0.25/0.75)-\log(0.75/0.25)=-1.099-1.099=-2.197\). Its starting state is approximately \((1.099,-2.197)\).

Both implied probabilities are strictly between 0 and 1, so both states are valid for this parameterization. The treatment contrasts start on opposite sides of zero, and the baseline log-odds also differ substantially. These are deliberately contrasting initial states; whether they are computationally stable and useful should be checked in the actual model and parameterization.

Warmup Is Not Posterior Sampling

Some algorithms adjust computational settings during warmup. A random-walk Metropolis algorithm may adjust a proposal scale; Hamiltonian Monte Carlo may tune a step size or a mass matrix. The earlier material on tuning proposal scales and acceptance rates motivates why tuning can help a sampler move efficiently. But adaptation means that transitions during warmup need not use the same fixed transition rule as transitions during the retained phase.

A straightforward workflow is to adapt during warmup, then hold the tuned settings fixed while collecting retained draws. This separation makes the retained phase easier to interpret as simulation under a fixed transition mechanism designed to preserve the target posterior. Adaptive MCMC can be valid under suitable technical conditions, but simply changing settings indefinitely does not automatically preserve the desired long-run behavior. In routine workflows, follow the sampler’s documented warmup procedure and verify that adaptation has ended before treating subsequent draws as retained sampling.

Discarding warmup does not itself make the retained draws exact posterior draws. If a chain has not moved into the relevant posterior regions, or still depends strongly on its start, then its post-warmup output may remain unrepresentative. Warmup is a computational provision, not a certificate of convergence.

Worked Example: Counting Warmup and Retained Iterations

Suppose four chains are each run for 5,000 iterations, with iterations 1 through 1,000 designated as warmup. For each chain, determine how many draws are discarded and retained, and calculate the total number of retained draws.

The retained iteration numbers are 1,001 through 5,000, inclusive. Therefore, each chain retains \(5{,}000-1{,}000=4{,}000\) draws and discards 1,000 warmup draws. Across four chains, the retained total is \(4\times4{,}000=16{,}000\) draws, while \(4\times1{,}000=4{,}000\) warmup draws are excluded.

The total of 16,000 retained draws is a count, not a count of independent observations. Serial dependence within each chain means that it should not be interpreted as 16,000 independent posterior samples.

Why Agreement Across Starts Is Useful

If a chain has adequately explored the target posterior, its distribution should become less dependent on its initial state. Therefore, chains started in different regions that later produce similar summaries offer evidence that the computation has not remained trapped near one starting value. The logic can be stated precisely using total variation distance. Suppose that, at a particular iteration, each chain’s distribution is within \(\varepsilon\) of the target posterior in total variation distance. For any event \(A\), each chain then assigns a probability to \(A\) within \(\varepsilon\) of \(\pi(A\mid y)\), so two chains’ probabilities differ by at most \(2\varepsilon\):

$$ \left|P_m(\theta_{m,t}\in A)-P_n(\theta_{n,t}\in A)\right| \leq \left|P_m(\theta_{m,t}\in A)-\pi(A\mid y)\right| + \left|\pi(A\mid y)-P_n(\theta_{n,t}\in A)\right| \leq 2\varepsilon. $$

This justifies the diagnostic idea: if chains are each close to the target, their behavior should broadly agree. The implication does not run in reverse. Similar behavior in a finite run does not prove that the chains are close to the target; they may all have missed the same region. The result also concerns chain distributions, not a guarantee that finite-sample summaries will match exactly.

Worked Example: Interpreting Agreement in Treatment-Effect Summaries

Suppose four hypothetical chains for a treatment log-odds contrast \(\beta\) produce the following retained-draw means: \(-0.18\), \(-0.15\), \(-0.21\), and \(-0.17\). Their individual retained-draw ranges are, respectively, \([-0.82,0.43]\), \([-0.77,0.48]\), \([-0.88,0.39]\), and \([-0.79,0.46]\). Summarize what this agreement does and does not show.

The largest chain mean is \(-0.15\), and the smallest is \(-0.21\), so their range is \(0.06\) log-odds units. The unweighted average of the four chain means is \(\{(-0.18)+(-0.15)+(-0.21)+(-0.17)\}/4=-0.1775\), or about \(-0.178\) log-odds units. The reported ranges overlap substantially, and the chain means are close relative to the spread of the reported values.

This is reassuring qualitative evidence that the chains are giving similar summaries despite their different starts. It is not proof that the posterior has been fully explored: all four chains could, for example, have missed a separate region. Nor does the average of the chain means by itself establish adequate Monte Carlo precision. More complete diagnostics are needed before relying on final posterior summaries.

Practical Checks and Common Failure Modes

A useful setup checks both the model and the simulation. Confirm that each initial state satisfies parameter constraints, that all chains target the same posterior and use separate random-number streams, and that the warmup and retained iteration ranges are recorded unambiguously. During and after computation, look for evidence that one chain behaves unlike the others or remains near its starting state. These are reasons to investigate, not a substitute for a formal assessment.

  • Starts are too similar. Multiple chains initialized almost identically may agree because they all explored the same limited region. Use meaningfully dispersed valid starts.
  • Starts are invalid or numerically extreme. A chain may fail immediately or spend warmup recovering from an unrealistic state. Check support constraints and computation before launching a long run.
  • Warmup draws are retained accidentally. If adaptation occurred during those iterations, including them can mix draws generated under changing settings with the intended retained phase. Mark the boundary explicitly.
  • Warmup is assumed to guarantee convergence. A chosen number of iterations cannot ensure that every model has reached all relevant posterior regions. Reassess if chains still show dependence on their starts or disagree.
  • Agreement is treated as proof. Agreement is useful evidence, not a proof of convergence. Shared implementation errors or a region missed by every chain can produce misleading agreement.

Choosing a Chain Strategy

A single long chain avoids between-chain comparisons, but provides less direct evidence about sensitivity to initialization. Several chains run from nearly identical states may add computation without much protection against a shared failure. Several chains with dispersed valid starts are more informative about whether the computation is sensitive to its starting region, though they still cannot rule out every failure.

StrategyStrengthMain limitation
One long chainUses computation in one continuous run.Cannot compare behavior across distinct starts.
Several chains with similar startsAllows repeated runs.Agreement may reflect shared initialization rather than broad exploration.
Several chains with dispersed valid startsProvides a more informative check for sensitivity to starting location.Agreement remains evidence, not proof, that the target has been explored.

If exact or conjugate posterior calculations are available for a simpler version of the model, they can also provide a benchmark for checking a simulation. That comparison answers a different question from chain separation: agreement between chains assesses sensitivity to starting points, while a benchmark checks whether numerical output matches a result available by another calculation.

Key takeaway: Initialize multiple chains at distinct, valid states; use warmup for movement and any planned adaptation; then retain draws from the post-warmup phase. Similar behavior from dispersed starts is valuable diagnostic evidence, but neither a long warmup nor cross-chain agreement alone proves that the posterior has been adequately explored.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. Why should chains targeting the same posterior use distinct starting states and separate random-number streams?
  2. Four chains each run for 3,200 iterations, with the first 700 used as warmup. How many retained draws are there in total?
  3. Why is it incorrect to interpret 12,000 retained draws as 12,000 independent posterior observations?
  4. All chains have nearly identical retained means, but each began at almost the same value. What is the limitation of that agreement?
  5. Does discarding warmup prove that the retained draws come from the posterior? Explain.

Solutions. 1. Distinct valid starts make it more informative to check sensitivity to initialization; separate random-number streams keep the chains’ simulation histories separate. 2. Each chain retains \(3{,}200-700=2{,}500\) draws, so the total is \(4\times2{,}500=10{,}000\). 3. Successive draws within a chain are generally dependent, so the retained count is not an independent-sample count. 4. Similar starts may lead all chains to explore the same limited region; agreement is less informative than agreement from dispersed starts. 5. No. Discarding warmup removes the designated initial iterations, but does not guarantee that the chain has adequately explored the posterior.

Clinical Biostats