Tutorials › Bayesian Clinical Trials › Reporting Posterior Computation Diagnostics

Reporting and Interpretation · Tutorial 659 of 696

Reporting Posterior Computation Diagnostics

Learn to summarize posterior computation diagnostics clearly, distinguish simulation error from posterior uncertainty, and identify when computational limitations make reported results less reliable.

Intermediate 12 min read

What You'll Learn

  • Explain why posterior computation diagnostics matter when results are based on Markov chain Monte Carlo.
  • Report chain counts, retained draws, convergence checks, effective sample sizes, and Monte Carlo standard errors.
  • Interpret split-\(\hat{R}\), bulk and tail effective sample sizes, and trace plots without treating them as proof of convergence.
  • Calculate simulation error for a posterior mean and a posterior probability.
  • Recognize warning signs such as poor mixing, chain disagreement, and Hamiltonian Monte Carlo divergences.
  • Separate computational uncertainty from posterior uncertainty and describe limitations transparently.

Why Posterior Computation Diagnostics Belong in a Trial Report

A reported posterior mean, quantile, or probability may be calculated from a numerical approximation rather than directly from a closed-form distribution. In Bayesian clinical trials, Markov chain Monte Carlo (MCMC) is one common way to obtain that approximation. The resulting draws are used to summarize treatment effects, probabilities of benefit, and other quantities of clinical interest. Diagnostics help readers assess whether the computation appears to have explored the relevant posterior distribution adequately and whether simulation error could affect the reported numbers.

Computation diagnostics answer a narrower question than clinical interpretation: how reliably did the numerical procedure approximate the specified posterior distribution? They do not establish that the model is appropriate, the prior is suitable, the data are accurate, or the trial conclusion is clinically justified. A computation can be numerically stable while the model is still a poor representation of the trial.

Definition: Computational uncertainty is uncertainty arising because a posterior quantity is estimated using a finite numerical sample, such as a finite set of MCMC draws. Posterior uncertainty is the uncertainty about model parameters represented by the posterior distribution, conditional on the model, prior, and observed data. They are distinct: more simulation can reduce computational uncertainty, but does not by itself reduce posterior uncertainty.

What to Report for MCMC

An MCMC output consists of dependent draws generated sequentially. Dependence means that the number of retained iterations is not generally the number of independent pieces of information in the simulation. A useful report therefore describes both the sampling procedure and evidence about its performance.

At minimum, state the sampler used, the number of chains, the number of warm-up iterations and retained iterations per chain, and any relevant tuning or adaptation details. Report the convergence diagnostics and effective sample sizes for the quantities that support the trial’s main claims. For a model fitted with Hamiltonian Monte Carlo, also report relevant sampler-specific warnings, such as divergent transitions, if present. State the software and version when needed for reproducibility.

Definition: The effective sample size (ESS) for a posterior quantity is an estimate of the number of independent draws that would provide approximately the same Monte Carlo precision as the correlated MCMC draws. ESS depends on the quantity being estimated; it is not simply the total number of retained iterations.

Convergence checks should look for evidence that chains have reached and explored the same target distribution. A trace plot displays sampled values against iteration. After warm-up, a well-behaved trace for a parameter often looks like a stable, overlapping band without persistent drift, long periods stuck in one region, or chains occupying clearly different regions. A trace plot is a visual diagnostic, not a proof.

A commonly reported numerical diagnostic is split-\(\hat{R}\). It compares variation within chains with variation between chains, after splitting chains into segments. If chains have mixed adequately, these sources of variation should be similar and \(\hat{R}\) should be close to 1. Values appreciably above 1 suggest that chains may not have converged or mixed well. In practice, analysts often seek values below about 1.01, while also checking trace plots and other diagnostics. A value near 1 is not sufficient evidence on its own: chains can agree while all fail to explore an important region.

Report both bulk and tail ESS when available. Bulk ESS reflects sampling efficiency for central features of the distribution and is relevant to summaries such as the posterior mean. Tail ESS assesses sampling in the distribution’s tails and is important for quantiles and tail probabilities. A high bulk ESS does not guarantee precise estimation of an extreme quantile or a small tail probability.

Monte Carlo Standard Error

The Monte Carlo standard error (MCSE) estimates the numerical simulation error in a computed posterior summary. For a posterior mean estimated from \(M\) draws with effective sample size \(ESS\), a common approximation is the estimated posterior standard deviation divided by the square root of the ESS. For a posterior probability, use the sampled indicator that the event occurred.

$$ MCSE(\bar{\theta}) \approx \frac{s_{\theta}}{\sqrt{ESS}} $$
$$ MCSE(\hat{q}) \approx \sqrt{\frac{\hat{q}(1-\hat{q})}{ESS}} $$

Here \(\bar{\theta}\) is the simulated posterior mean, \(s_{\theta}\) is the sample standard deviation of the retained draws for \(\theta\), and \(\hat{q}\) is the fraction of draws satisfying an event, such as a treatment effect exceeding a clinical threshold. These are approximate calculations; use the ESS appropriate to the quantity being estimated. MCSE describes simulation precision, not the spread of the posterior distribution and not a frequentist standard error for the clinical effect.

Justification: For independent draws, the variance of a sample mean is the variance of one draw divided by the number of draws. Correlated MCMC draws provide less information than the same number of independent draws, so ESS replaces the raw draw count in the approximation. For a posterior probability, each draw contributes an indicator, which has variance approximately \(\hat{q}(1-\hat{q})\); taking the square root of this variance divided by ESS gives the MCSE formula above.

Worked Example: Reporting Diagnostics for a Posterior Mean

Hypothetical trial analysis. A treatment effect is measured as the difference in symptom duration, in days, between the treatment and control groups. Four MCMC chains each retain 5,000 draws after warm-up. The pooled posterior draws have a standard deviation of 4.00 days. The reported bulk ESS for the treatment effect is 6,800, and split-\(\hat{R}\) is 1.002.

The approximate MCSE for the posterior mean is

$$ MCSE(\bar{\theta}) \approx \frac{4.00\text{ days}}{\sqrt{6800}} = \frac{4.00}{82.46}\text{ days} \approx 0.04851\text{ days}. $$

The four chains contain 20,000 retained draws in total, but the estimated ESS for this quantity is 6,800 because the draws are correlated. The split-\(\hat{R}\) value is close to 1, which is reassuring, and the mean’s estimated simulation error is about 0.05 days. A suitable report would give the chain and draw counts, split-\(\hat{R}\), ESS, and MCSE, while noting that the MCSE is small relative to the posterior spread of 4.00 days. These checks support the numerical precision of the mean; they do not establish that the treatment-effect model is clinically appropriate.

Assessing a Reported Posterior Probability

Posterior probabilities are often central to a trial conclusion, so their simulation precision deserves direct attention. For example, a report might give the posterior probability that treatment reduces symptom duration by at least a prespecified clinically meaningful amount. The relevant ESS is the ESS for that event indicator, not automatically the bulk ESS for a model parameter.

Worked Example: Simulation Error in a Posterior Benefit Probability

Hypothetical trial analysis. Of the MCMC draws, the estimated posterior probability that the treatment benefit exceeds a prespecified clinical threshold is \(\hat{q}=0.94\). The event-specific ESS is 2,400. The approximate MCSE is

$$ MCSE(\hat{q}) \approx \sqrt{\frac{0.94(1-0.94)}{2400}} = \sqrt{\frac{0.0564}{2400}} = \sqrt{0.0000235} \approx 0.004848. $$

In percentage-point units, the estimated simulation error is \(0.004848 \times 100 = 0.4848\) percentage points. Thus the reported probability of 94% has estimated Monte Carlo error of about 0.4848 percentage points under this approximation. This is a measure of numerical precision, not a statement that there is a 94% chance the computation is correct or that the clinical benefit is certain. The report should give the probability, the event-specific ESS, and the MCSE, and should interpret the probability using the clinical context and the model assumptions.

When Diagnostics Signal a Problem

Poor diagnostics should change how confidently numerical summaries are reported. Warning signs include chains with visibly different locations or patterns, persistent trends after warm-up, a split-\(\hat{R}\) appreciably above 1, low ESS, large MCSE relative to the precision of reported results, and sampler warnings. For Hamiltonian Monte Carlo, divergent transitions can indicate that the algorithm is having difficulty exploring parts of a posterior with challenging geometry. They should be investigated rather than hidden by reporting only a long run.

The response depends on the warning. Analysts may inspect the model and parameterization, verify that data and code are correct, consider a suitable reparameterization, or use a sampler better suited to the posterior. Extending a run can increase ESS when the existing chains are exploring the target distribution adequately. It is not a general remedy for chains stuck in different regions, persistent divergences, or a model that creates difficult or weakly identified parameters.

Worked Example: Reporting a Run With Warning Signs

Hypothetical trial analysis. A four-chain Hamiltonian Monte Carlo fit retains 4,000 draws per chain for a treatment-by-subgroup effect measured in percentage points. The chains occupy noticeably different ranges in their trace plots, split-\(\hat{R}\) is 1.08, and 23 of 4,000 retained transitions are flagged as divergent.

The divergent proportion is

$$ \frac{23}{4000}=0.00575=0.575\%. $$

The chain disagreement and \(\hat{R}=1.08\) are strong warnings that the computation has not demonstrated satisfactory mixing for this effect. The divergence proportion adds a sampler-specific warning; it does not make the estimate reliable merely because it is below 1%. A responsible report would identify these diagnostics and state that the subgroup-effect summaries are computationally uncertain. The analyst should investigate the model and sampling behavior before relying on those summaries. If the issue cannot be resolved, the limitation should be disclosed and the affected conclusions treated cautiously, rather than presented with unqualified numerical precision.

Choosing and Reporting Diagnostics in Context

Diagnostics should be matched to the quantities that drive the trial’s interpretation. If the primary conclusion depends on a posterior mean, report its ESS and MCSE. If it depends on a credible interval, examine tail ESS and the numerical stability of its endpoints. If it depends on a posterior probability crossing a decision threshold, report an event-specific ESS and MCSE. In each case, assess trace plots and chain agreement for the relevant parameters and derived quantities.

MCMC is not the only way to compute posterior summaries. Some models permit exact calculations or deterministic numerical integration; others use approximate methods such as variational inference. Exact or deterministic calculations do not have MCMC chain diagnostics, although their own numerical accuracy and approximation assumptions still matter. MCMC provides simulation-based diagnostics but can be computationally demanding. The appropriate method depends on the model and the precision required; a method’s label alone does not guarantee accuracy.

The numerical precision required is also a reporting decision. If an MCSE is large enough to change a rounded probability, quantile, or decision threshold comparison, additional computation or a more careful qualification may be necessary. Conversely, increasing simulation far beyond what can affect the reported precision may add little practical value. Do not imply that more iterations resolve uncertainty about the model, prior, or trial design.

1
Describe the computation.
Give the sampler, chain count, warm-up and retained draws, and relevant software or tuning details.
2
Check chain behavior.
Review trace plots and split-\(\hat{R}\), and investigate signs of drift, disagreement, or poor exploration.
3
Assess precision for key results.
Report bulk or tail ESS as appropriate and MCSE for the posterior summaries that support the trial’s conclusions.
4
Disclose limitations.
Describe unresolved warnings and explain how computational limitations affect confidence in the affected summaries.

Common Mistakes and Limitations

  • Equating retained draws with independent information. MCMC draws are generally correlated, so ESS can be much smaller than the raw number of iterations.
  • Treating \(\hat{R}\) near 1 as proof of convergence. It is a useful diagnostic, but it cannot rule out all failures to explore the posterior.
  • Using one ESS for every result. ESS depends on the quantity being estimated; means, tail quantiles, and event probabilities can have different effective sample sizes.
  • Calling MCSE posterior uncertainty. MCSE describes numerical error from finite simulation. Posterior spread describes uncertainty represented by the fitted posterior.
  • Responding to every problem by running longer. More iterations may help when exploration is sound but may not fix poor parameterization, chain separation, or sampler pathologies.
  • Reporting only reassuring diagnostics. A transparent report includes material warnings and explains their implications, rather than selecting only favorable metrics.

Diagnostics are evidence about computation, not a certificate of validity. They cannot confirm that the prior, likelihood, endpoint definition, missing-data assumptions, or clinical interpretation is appropriate. Those considerations remain part of a complete trial analysis and report.

Check Your Understanding

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

  1. Why is the number of retained MCMC draws not generally equal to the effective sample size?
  2. A posterior mean has an estimated standard deviation of 6 units and ESS of 900. Calculate its approximate MCSE.
  3. A posterior probability is estimated as 0.80 with event-specific ESS 1,600. Calculate its approximate MCSE.
  4. What should an analyst conclude when split-\(\hat{R}\) is close to 1 but trace plots show chains occupying distinct regions?
  5. Does a small MCSE establish that a trial’s model and prior are appropriate? Explain.

Solutions. (1) MCMC draws are usually autocorrelated, so they contain less information than the same number of independent draws; ESS estimates the equivalent independent-draw count for a particular quantity. (2) \(MCSE \approx 6/\sqrt{900}=6/30=0.200\) units. (3) \(MCSE \approx \sqrt{0.80(0.20)/1600}=\sqrt{0.0001}=0.0100\), or 1.00 percentage point. (4) Do not regard the computation as adequately established by \(\hat{R}\) alone: the trace-plot disagreement is a warning of possible poor exploration, and the chains should be investigated. (5) No. A small MCSE indicates numerical precision for the estimated summary, not validity of the model, prior, data, or clinical interpretation.

Clinical Biostats