Bridge Sampling Diagnostics

Giorgio Micaletto, Aki Vehtari · 2025

Read Bridge Sampling Diagnostics by Giorgio Micaletto, Aki Vehtari (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2508-14487.txt.

Introduction

Giorgio Micaletto and Aki Vehtari add error checks to a Bayesian model comparison tool, in this 2025 paper. Bridge sampling estimates a model's overall fit, but its error can balloon when the proposal and target shapes overlap poorly. Users had no firm way to know when to trust it.

The pair give a closed-form error estimate with fixes for chained, correlated draws and exact log-scale spread. The estimate caps near 1.05, so values near the cap mean saturation, not precision. Tests suggest trust below 0.3. A hybrid proposal that borrows local shape steadied the method further. Trials used fake and real posteriors of rising difficulty.

Catalog record

CREATORGiorgio Micaletto, Aki Vehtari
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE30 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2508-14487

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Bridge Sampling Diagnostics Giorgio Micaletto, Aki Vehtari Abstract In Bayesian statistics, the marginal likelihood is used for model selection and averaging, yet it is often challenging to compute accurately for complex models. Approaches such as bridge sampling, while effective, may suffer from issues of high variability of the estimates. We present how to estimate Monte Carlo standard error (MCSE) for bridge sampling, and how to diagnose the reliability of MCSE estimates using Pareto- k ^ \hat{k} and block reshuffling diagnostics without the need to repeatedly re-run full posterior inference. We demonstrate the behavior with increasingly more difficult simulated posteriors and many real posteriors from the posteriordb database. 1 Introduction The marginal likelihood is commonly used in Bayesian statistics. The purpose of this paper is not to advocate the use of marginal likelihood for model selection, but as marginal likelihood is used anyway, the goal is to help reducing the amount of computation used with practical diagnostics. Let \mathcal{M} represent the Bayesian model of interest. The marginal likelihood given the observed data \mathbf{y} is p(\mathbf{y}\mid\mathcal{M})=\int_{\Theta}p(\mathbf{y}\mid\theta,\mathcal{M})p(\theta\mid\mathcal{M})\,d\theta, (1) where p(\mathbf{y}\mid\theta,\mathcal{M})=\prod_{i=1}^{n}p(y_{i}\mid\theta,\mathcal{M}) is the likelihood of \theta given observed data y_{i} and the model \mathcal{M} , p(\theta\mid\mathcal{M}) is the prior distribution of the parameters \theta , and \Theta is the parameter space. For all but the simplest cases, this integral becomes intractable, requiring numerical methods to approximate it. We examine the finite sample size accuracy of bridge sampling algorithm for estimating the marginal likelihood p(\mathbf{y}\mid\mathcal{M}) . We (i) derive a closed-form expression for the Monte-Carlo standard error (MCSE) of the bridge sampling estimator, and (ii) introduce two complementary diagnostics–the Pareto- \hat{k} tail index and a block-reshuffling bootstrap–to assess the adequacy of that MCSE estimate given finite MCMC sample size. 2 Bridge Sampling One of the fastest and most reliable approaches to estimate the marginal likelihood is bridge sampling, first introduced by Bennett, 1976 and nicely reviewed by Gronau et al., 2017 . The fundamental principle behind bridge sampling is the following identity 1=\frac{\int p(\mathbf{y}\mid\theta,\mathcal{M})p(\theta\mid\mathcal{M})h(\theta)g(\theta)}{\int p(\mathbf{y}\mid\theta,\mathcal{M})p(\theta\mid\mathcal{M})h(\theta)g(\theta)}, (2) which allows p(\mathbf{y}\mid\mathcal{M}) to be written as p(\mathbf{y}\mid\mathcal{M})=\frac{\mathbb{E}_{g(\theta)}\left[p(\mathbf{y}\mid\theta,\mathcal{M})p(\theta\mid\mathcal{M})h(\theta)\right]}{\mathbb{E}_{\text{post}}\left[h(\theta)g(\theta)\right]}, (3) which consequently permits an approximation of the form \hat{p}(\mathbf{y}\mid\mathcal{M})=\frac{\frac{1}{S_{2}}\sum_{i=1}^{S_{2}}p(\mathbf{y}\mid\tilde{\theta}_{i},\mathcal{M})p(\tilde{\theta}_{i}\mid\mathcal{M})h(\tilde{\theta}_{i})}{\frac{1}{S_{1}}\sum_{j=1}^{S_{1}}h(\theta^{*}_{j})g(\theta^{*}_{j})}, (4) where S_{1} is the number of Markov chain Monte Carlo draws \theta^{*}_{j} from the posterior distribution p(\theta\mid\mathbf{y},\mathcal{M}) , S_{2} is the number of draws \tilde{\theta}_{i} from a proposal distribution g(\theta) with known normalization constant, and h(\theta) is the bridge function. To ensure the effectiveness of bridge sampling, g(\theta) has to closely approximate p(\theta\mid\mathbf{y},\mathcal{M}) , be easy to sample from, and have a known normalization constant. For these reasons, it is typically chosen to be a multivariate normal distribution, denoted by \operatorname{N}(\mu,\Sigma) , where the mean vector \mu and covariance matrix \Sigma are estimated using additional posterior draws. Usually the original posterior draws are divided in two sets, with one set used as \theta^{*}_{j} and the other set used to estimate the parameters of the proposal distribution g(\theta) . Instead of the normal distribution, other distributions with known normalization constants can be used, or the posterior may be warped to resemble more closely a normal distribution, and the marginal likelihood is then computed based on this warped distribution, which preserves the same normalizing constant as the original distribution. The bridge function h typically used is the one proposed by Meng and Wong, 1996 : h(\theta)\propto\frac{1}{s_{1}p(\mathbf{y}\mid\theta,\mathcal{M})p(\theta\mid\mathcal{M})+s_{2}p(\mathbf{y}\mid\mathcal{M})g(\theta)}, (5) where s_{1}\coloneqq\frac{S_{1}}{S_{1}+S_{2}}\quad\text{and}\quad s_{2}\coloneqq\frac{S_{2}}{S_{1}+S_{2}}. Because ( 5 ) depends on the marginal likelihood p(\mathbf{y}\mid\mathcal{M}) , the bridge sampling estimator is refined through an iterative scheme: \hat{p}^{(t+1)}(\mathbf{y}\mid\mathcal{M})=\frac{\dfrac{1}{S_{2}}\sum_{i=1}^{S_{2}}\dfrac{l_{2,i}}{s_{1}l_{2,i}+s_{2}\hat{p}^{(t)}(\mathbf{y}\mid\mathcal{M})}}{\dfrac{1}{S_{1}}\sum_{j=1}^{S_{1}}\dfrac{1}{s_{1}l_{1,j}+s_{2}\hat{p}^{(t)}(\mathbf{y}\mid\mathcal{M})}},\qquad\text{with}\;\hat{p}^{(0)}(\mathbf{y}\mid\mathcal{M})=1. (6) where l_{1,j}\coloneqq\frac{p(\mathbf{y}\mid\theta^{*}_{j},\mathcal{M})p(\theta^{*}_{j}\mid\mathcal{M})}{g(\theta^{*}_{j})}, and l_{2,i}\coloneqq\frac{p(\mathbf{y}\mid\tilde{\theta}_{i},\mathcal{M})p(\tilde{\theta}_{i}\mid\mathcal{M})}{g(\tilde{\theta}_{i})}. The iteration process continues until the magnitude of the update falls below a predefined threshold and, to prevent the algorithm from oscillating indefinitely, it is also set to terminate after a specified maximum number of iterations. Unlike plain importance sampling, bridge sampling is less sensitive to the mismatch in tail thickness in proposal and posterior distribution. Specifically, both ratios in the numerator and denominator in Equation ( 6 ) are bounded by construction ( Gronau et al., 2017 , see, e.g.,) . The bounded ratios imply that both the numerator and denominator have finite variance, and thus the whole estimator has finite variance. 3 Monte Carlo Standard Error As the first step to assess the accuracy of the bridge sampling estimate, we propose to compute Monte Carlo standard error (MCSE). The estimator \hat{p}(\mathbf{y}) given in Equation ( 4 ) is a ratio of two sample means: \hat{p}(\mathbf{y}\mid\mathcal{M})=\frac{\bar{N}}{\bar{D}}, with \displaystyle\bar{N} \displaystyle=\frac{1}{S_{2}}\sum_{i=1}^{S_{2}}N_{i},\quad N_{i}\,\coloneqq\,p(\mathbf{y}\mid\tilde{\theta}_{i},\mathcal{M})\,p(\tilde{\theta}_{i}\mid\mathcal{M})\,h(\tilde{\theta}_{i}), \displaystyle\bar{D} \displaystyle=\frac{1}{S_{1}}\sum_{j=1}^{S_{1}}D_{j},\quad D_{j}\,\coloneqq\,h(\theta^{*}_{j})\,g(\theta^{*}_{j}). To compute the variance of \hat{p}(\mathbf{y}\mid\mathcal{M}) , we use the delta method, thus, the variance estimate is given by: \operatorname{Var}\left(\hat{p}\left(\mathbf{y}\mid\mathcal{M}\right)\right)\approx\frac{1}{S_{1}}\left(\frac{\bar{N}}{\bar{D}}\right)^{2}\left(\frac{\operatorname{Var}(\bar{N})}{\bar{N}^{2}}+\frac{\operatorname{Var}(\bar{D})}{\bar{D}^{2}}-2\,\frac{\operatorname{Cov}(\bar{N},\bar{D})}{\bar{N}\,\bar{D}}\right), (7) assuming that S_{1}=S_{2} . As \bar{N} and \bar{D} are sample means, their variances and covariance are: \displaystyle\operatorname{Var}(\bar{N}) \displaystyle=\frac{\operatorname{Var}(N_{i})}{S_{2}}, \displaystyle\operatorname{Var}(\bar{D}) \displaystyle=\frac{\operatorname{Var}(D_{j})}{S_{1}}, \displaystyle\operatorname{Cov}(\bar{N},\bar{D}) \displaystyle=\frac{\operatorname{Cov}(N_{i},D_{j})}{S_{1}}. The draws \tilde{\theta}_{i} and \theta^{*}_{j} are independent, and thus \operatorname{Cov}(\bar{N},\bar{D})=0 . Substituting back, we get \operatorname{Var}\left(\hat{p}\left(\mathbf{y}\mid\mathcal{M}\right)\right)\approx\frac{1}{S_{1}}\left(\frac{\bar{N}}{\bar{D}}\right)^{2}\left(\frac{\operatorname{Var}(N_{i})}{S_{2}\,\bar{N}^{2}}+\frac{\operatorname{Var}(D_{j})}{S_{1}\,\bar{D}^{2}}\right). (8) If \theta^{*}_{j} are drawn using MCMC, terms D_{j} may also have significant autocorrelation and estimate for \operatorname{Var}(\bar{D}) should then take that into account. In the experiments we used MCMC effective sample size estimate by Vehtari et al., 2021 . Finally \operatorname{MCSE}\left(\hat{p}\left(\mathbf{y}\mid\mathcal{M}\right)\right)=\sqrt{\operatorname{Var}\left(\hat{p}\left(\mathbf{y}\mid\mathcal{M}\right)\right)}. (9) To compute the MCSE of the logarithm of the marginal likelihood estimate, \log\hat{p}(\mathbf{y}\mid\mathcal{M}) , we use the property of the log-normal distribution to get \operatorname{Var}\left(\log\hat{p}\left(\mathbf{y}\mid\mathcal{M}\right)\right)=\log\left(1+\frac{\operatorname{Var}\left(\hat{p}\left(\mathbf{y}\mid\mathcal{M}\right)\right)}{\left(\hat{p}\left(\mathbf{y}\mid\mathcal{M}\right)\right)^{2}}\right). Then \operatorname{MCSE}\left(\log\hat{p}\left(\mathbf{y}\mid\mathcal{M}\right)\right)=\sqrt{\operatorname{Var}\left(\log\hat{p}\left(\mathbf{y}\mid\mathcal{M}\right)\right)}. (10) The MCSE quantifies the uncertainty in the estimated (log) marginal likelihood due to the finite sample sizes S_{1} and S_{2} , conditional on the proposal and the final bridge function when the iteration ends. In cases when the proposal is very different from the posterior or when the iterative algorithm fails to converge there can be additional variation. In Section 5 , we present a block reshuffling approach which takes into account all the parts of the bridge sampling algorithm. However, based on the experiments reported in Section 6 , the presented MCSE estimator alone is often sufficiently accurate. 4 Pareto- \hat{k} Diagnostic Let N_{i}\;=\;p(\mathbf{y}\mid\tilde{\theta}_{i},\mathcal{M})\,p(\tilde{\theta}_{i}\mid\mathcal{M})\,h(\tilde{\theta}_{i}),\qquad D_{j}\;=\;h(\theta^{*(j)})\,g(\theta^{*(j)}), so that the bridge estimator can be expressed as \hat{p}(\mathbf{y}\mid\mathcal{M})\;=\;\frac{\bar{N}}{\bar{D}},\qquad\bar{N}=\frac{1}{S_{2}}\sum_{i=1}^{S_{2}}N_{i},\qquad\bar{D}=\frac{1}{S_{1}}\sum_{j=1}^{S_{1}}D_{j}. Because h(\cdot) , g(\cdot) and p(\mathbf{y}\mid\cdot,\mathcal{M})\,p(\cdot\mid\mathcal{M}) are all non-negative and bounded above on \Theta , there exist deterministic constants B_{N},B_{D}<\infty such that 0\;\leq\;N_{i}\leq B_{N},\qquad 0\;\leq\;D_{j}\leq B_{D}\quad\text{a.s.} Consequently, moments of distributions of N_{i} and D_{j} are all finite, and standard results (law of large numbers, delta method) guarantee that \sqrt{S_{1}}\!\left(\hat{p}(\mathbf{y}\mid\mathcal{M})-p(\mathbf{y}\mid\mathcal{M})\right)\;\xrightarrow{d}\;\operatorname{N}\bigl(0,\sigma^{2}\bigr), so, the variance-based Monte-Carlo standard error (MCSE) is asymptotically exact. In practice the upper bounds B_{N} and B_{D} can be so large that, for realistic sample sizes S_{1},S_{2} , observations near either bound are exceedingly rare. The resulting finite sample behavior can be similar to that of heavy-tailed, or even infinite-variance, distributions: a single extreme realization may dominate \bar{N} or \bar{D} and inflate the estimator’s variance long before asymptotic behavior kicks in. Standard MCSE formulas, which assume finite variance, therefore give no early warning of this pre-asymptotic hazard. To diagnose this failure mode we use the Pareto– \hat{k} diagnostic of Vehtari et al., 2024 ; suppose we have S non-negative summands \{Z_{i}\}_{i=1}^{S}\subset\mathbb{R}_{+} . We order Z_{(1)}\geq Z_{(2)}\geq\cdots\geq Z_{(S)} and take M\;=\;\Bigl\lfloor\min\{\,0.2\,S,\;3\sqrt{S}\}\Bigr\rfloor,\qquad u=Z_{(M)},\qquad E_{i}=Z_{(i)}-u,\;i=1,\dots,M. The excesses \{E_{i}\} are modeled with a generalized Pareto distribution p(x\mid u,\sigma,k)=\begin{cases}\dfrac{1}{\sigma}\left(1+k\,\dfrac{x}{\sigma}\right)^{-\left(\tfrac{1}{k}+1\right)},&k\neq 0,\;x\geq 0,\\[10.0pt] \dfrac{1}{\sigma}\exp\bigl(-x/\sigma\bigr),&k=0,\;x\geq 0,\end{cases} and the shape parameter k is estimated using the fast approximate Bayesian computation proposed by Zhang and Stephens, 2009 , yielding the scalar diagnostic \hat{k} . A value \hat{k}<0.5\quad\bigl(\text{or }0.7\text{ with smoothing}\bigr) indicates that the empirical mean

Read the complete text