Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Talts et al. (2018)

San Diego State University

The big idea

Every Bayesian analysis runs an inference algorithm (MCMC, HMC, variational, INLA) whose correctness is rarely checked — “we always get some result from a given algorithm, [but] we have no idea how good it might be without some form of validation.” Simulation-Based Calibration (SBC) is a generic procedure that validates whether an algorithm samples the posterior correctly, for any model you can simulate from, using only forward draws — no analytic posterior required.

The whole method rests on one exact self-consistency identity. If you draw a ground truth from the prior and data from it, the posterior averaged over all such datasets returns the prior (the data-averaged posterior, Eq. 1):

π(θ)=dy~dθ~  π(θy~)π(y~θ~)π(θ~).\pi(\theta) = \int \mathrm{d}\tilde{y}\,\mathrm{d}\tilde{\theta}\; \pi(\theta \mid \tilde{y})\,\pi(\tilde{y} \mid \tilde{\theta})\,\pi(\tilde{\theta}).

Any discrepancy between the data-averaged posterior and the prior signals a broken posterior computation or a mis-implemented model. SBC turns this identity into a sharp, easy-to-read test. It is the corrected, sampling-friendly successor to Cook, Gelman & Rubin (2006), which used continuous CDF values that suffer discretization artifacts and need continuity corrections; SBC replaces those with discrete rank statistics that are exactly, not asymptotically, uniform.

Core results

The rank statistic (§4.1). Draw a prior sample θ̃ ~ π(θ), data ỹ ~ π(y|θ̃), and L posterior draws {θ_1,…,θ_L} ~ π(θ|ỹ). For any one-dimensional function f(θ), the rank of the prior draw among the posterior draws,

r({f(θ1),,f(θL)},f(θ~))=l=1L1 ⁣[f(θl)<f(θ~)][0,L],r\big(\{f(\theta_1),\dots,f(\theta_L)\},\, f(\tilde{\theta})\big) = \sum_{l=1}^{L} \mathbb{1}\!\left[f(\theta_l) < f(\tilde{\theta})\right] \in [0, L],

is uniformly distributed over the integers {0,…,L} when the posterior samples are genuine and independent (Theorem 1, proof in their Appendix B). This is exact for any joint distribution π(y,θ) — the lognormal-style normalizations and model details all cancel.

The SBC histogram + uniform band (Algorithm 1). Repeat for N simulated datasets, binning the N rank statistics into a histogram over the L+1 possible values. Under correct calibration the histogram is flat. Each histogram carries a gray band showing 99% of the variation expected from uniformity: the band runs from the 0.005 to the 0.995 percentile of Binomial(N, (L+1)^{-1}) (or Binomial(N, 1/B) for B merged bins), so on average only ~1 bin in 100 strays outside it. For variance reduction, merge neighbouring bins to keep N/B ≈ 20; choosing L+1 a power of two (e.g. L = 1023) makes the re-binning clean. Uniformity can also be quantified with a χ² test of the binned counts against the expected N/B per bin.

Deviation shapes are diagnostic (§4.2). How the histogram departs from flat tells you how the posterior is wrong:

Autocorrelation and thinning (§5.1, Algorithm 2). Theorem 1 assumes independent posterior draws. MCMC chains are correlated, which clusters draws relative to the prior sample and biases ranks toward the extremes — the same ∪-spikes as under-dispersion. The fix is to thin the chain to ≈independent states: keep every T-th draw so the effective sample size N_eff[f] ≤ N; antithetic chains (e.g. dynamic HMC with N_eff > N) should be thinned by 2 first. They suggest sizing the thinning from the minimum N_eff over a set of test quantiles (e.g. 19 equispaced quantiles of f(θ)).

Honest scope (§4). SBC validates only the computational/inference aspect “under the assumed model”: a green SBC means the algorithm samples the posterior correctly for the model as written. It is not a guarantee that the posterior covers the truth for any single dataset (that needs sensitivity analysis) or that the model is rich enough to match reality (that needs posterior predictive checks). SBC is “similar to checking the coverage of a credible interval under the assumed model.”

Use in progenax

The experimental gravoturb differentiable-inference layer uses SBC as workstream ① of its trustworthiness arc (see Differentiable inference — natal cloud parameters from cluster substructure), upgrading the α-recovery result from single-θ injection–recovery (AC16) to calibration across the whole prior:

Notes

References
  1. Cook, S. R., Gelman, A., & Rubin, D. B. (2006). Validation of Software for Bayesian Models Using Posterior Quantiles. Journal of Computational and Graphical Statistics, 15(3), 675–692. 10.1198/106186006X136976