Source-linked AI summary
A Tutorial on Bridge Sampling
Quentin F. Gronau, Alexandra Sarafoglou, Dora Matzke, Alexander Ly, Udo Boehm, Maarten Marsman, David S. Leslie, Jonathan J. Forster, Eric-Jan Wagenmakers, Helen Steingroever
TL;DR
Estimating marginal likelihoods is often difficult because they are not analytically tractable. This tutorial presents bridge sampling and finds it accurate, reliable, practical, and easy to implement for the EV model, including hierarchical models.
Problem
Marginal likelihoods are often not analytically tractable, creating a need for numerical approximation in Bayesian modeling.
Source: §3 · p. 3, Choosing the optimal bridge function · p. 18Method
The tutorial introduces bridge sampling and related methods through a beta-binomial example before applying bridge sampling to the EV model.
Source: Analytical derivation of the marginal… · p. 8, Discussion · p. 38Results
Bridge sampling produced accurate marginal-likelihood estimates for hierarchical models and demonstrated accuracy, reliability, practicality, and ease of implementation.
Source: Interim Summary · p. 24, Discussion · p. 36Takeaways & Limitations
Bridge sampling offers a reliable, easy-to-implement approach for estimating model marginal likelihoods.
Source: Discussion · p. 38Bridge sampling should not be used blindly, and it is unnecessary when the marginal likelihood can be determined analytically.
Source: Discussion · p. 37
Abstract
from arXiv · showhide
The marginal likelihood plays an important role in many areas of Bayesian statistics such as parameter estimation, model comparison, and model averaging. In most applications, however, the marginal likelihood is not analytically tractable and must be approximated using numerical methods. Here we provide a tutorial on bridge sampling (Bennett, 1976; Meng & Wong, 1996), a reliable and relatively straightforward sampling method that allows researchers to obtain the marginal likelihood for models of varying complexity. First, we introduce bridge sampling and three related sampling methods using the beta-binomial model as a running example. We then apply bridge sampling to estimate the marginal likelihood for the Expectancy Valence (EV) model---a popular model for reinforcement learning. Our results indicate that bridge sampling provides accurate estimates for both a single participant and a hierarchical version of the EV model. We conclude that bridge sampling is an attractive method for mathematical psychologists who typically aim to approximate the marginal likelihood for a limited set of possibly high-dimensional models.
1 Department of Psychology, University of Amsterdam, The Netherlands … Analytical derivation of the marginal likelihood.
This section introduces bridge sampling and three related Monte Carlo estimators as accessible alternatives for approximating marginal likelihoods when analytical derivations are unavailable. Using a beta-binomial running example, it presents the four methods and derives an analytic marginal likelihood as a benchmark.
- The marginal likelihood supports parameter estimation, model comparison, and Bayesian model averaging by normalizing posteriors and weighting models’ posterior distributions.In model comparison, the ratio of marginal likelihoods forms the Bayes factor; model averaging combines posterior distributions using posterior model probabilities.Source: §3 · pp. 2–3
- The problem is pressing in Bayesian modeling, particularly mathematical psychology, where models can be non-linear, equipped with a large number of parameters, and implemented in a hierarchical manner.Source: §3 · pp. 3–4
- The tutorial focuses on bridge sampling and its naive Monte Carlo, importance sampling, and generalized harmonic mean special cases.These methods are introduced progressively through a beta-binomial model, from the simplest estimator to the general bridge sampling estimator.Source: §3 · p. 4
- Bridge sampling is presented as accurate, efficient, and relatively straightforward to implement for approximating marginal likelihoods.The tutorial aims to facilitate application by providing a step-by-step implementation scheme for mathematical psychologists.Source: §3 · p. 4
Four Sampling Methods to Approximate the Marginal Likelihood
- The tutorial develops four methods for approximating marginal likelihoods, whose common foundation is expressing the marginal likelihood as a prior expectation.The methods are introduced as naive Monte Carlo, importance sampling, generalized harmonic mean, and bridge sampling.Source: Four Sampling Methods to Approximate… · p. 5, Analytical derivation of the marginal… · p. 7
Introduction of the Running Example: The Beta-Binomial Model
- The running example assumes k = 2 correct answers out of n = 10 under a binomial likelihood and uniform prior θ ∼Beta(1, 1).The uniform prior assigns equal prior density across θ ∈ (0, 1).Source: Introduction of the Running Example:… · pp. 5–6
Analytical derivation of the marginal likelihood.
- For k = 2 and n = 10, the beta-binomial model’s analytic marginal likelihood is 1/11 ≈0.0909.The beta-binomial model is one of the rare cases with an analytic marginal likelihood, which serves as the benchmark for subsequent estimators.Source: Analytical derivation of the marginal… · p. 7
- With a uniform prior, the posterior is Beta(k + 1, n −k + 1), yielding Beta(3, 9) for k = 2 and n = 10.Importance sampling, generalized harmonic mean, and bridge sampling require posterior samples, whereas this example’s analytic posterior makes MCMC unnecessary.Source: Analytical derivation of the marginal… · pp. 7–8
Method 1: The Naive Monte Carlo Estimator of the Marginal Likelihood … hood
This section introduces and develops Monte Carlo-based estimators for marginal likelihoods, including naive Monte Carlo, importance sampling, and the generalized harmonic mean estimator. It describes how tailored importance densities are constructed and applied to posterior samples in the beta-binomial example.
Method 1: The Naive Monte Carlo Estimator of the Marginal Likelihood
- The naive Monte Carlo estimator approximates marginal likelihood by averaging likelihood values evaluated at N samples drawn from the prior.In the beta-binomial example, 12 samples are used illustratively, although practice requires N to be very large.Source: Method 1: The Naive Monte Carlo… · p. 8, Running example · p. 8
Method 2: The Importance Sampling Estimator of the Marginal Likelihood
- Naive Monte Carlo performs well when prior and posterior distributions overlap, but becomes unstable with a peaked posterior because few high-likelihood samples dominate estimates and increase variance.This limitation motivates sampling from an importance density instead of the prior.Source: Method 2: The Importance Sampling… · p. 9
- Importance sampling addresses this shortcoming by using an importance density to boost samples in parameter-space regions where the integrand is large; suitable densities are easy to evaluate, share the posterior’s domain, resemble it, and have fatter tails.Source: Method 2: The Importance Sampling… · p. 10
hood
- The generalized harmonic mean estimator likewise targets regions where the integrand is large with an importance density gIS(θ), but requires thinner tails than importance sampling.It is also known as reciprocal importance sampling.Source: hood · p. 13
- The generalized harmonic mean estimator evaluates samples from the posterior distribution and requires an importance density with thinner tails than the posterior to avoid inflated ratios.The density should also be easy to evaluate, share the posterior’s domain, and closely resemble the posterior distribution.Source: hood · p. 14
- In the beta-binomial example, 12 posterior samples are probit-transformed so they span the real line rather than only the (0, 1) interval.The transformation allows the samples to be matched to a normal importance density; other transformations, such as the logit transformation, are possible.Source: hood · p. 14
- The transformed samples yield method-of-moments estimates of µ̂ = −0.793 and σ̂ = 0.423 for the fitted normal distribution.The probit transformation matches the posterior’s range to the normal distribution’s range.Source: hood · p. 15
- The chosen importance density is normal with mean µ̂ = −0.793 and standard deviation σ̂ = 0.423/1.5, producing thinner tails than the probit-transformed posterior.The division by 1.5 was used for illustrative purposes, and the resulting density is shown with the posterior in Figure 4.Source: hood · p. 15, Figure 4 · p. 15
- Applying the generalized harmonic mean formula with the probit-transformation correction yields an estimate of the beta-binomial model’s marginal likelihood.The supplied passage introduces the resulting calculation but does not provide its completed numerical value.Source: hood · pp. 15–16
Method 4: The Bridge Sampling Estimator of the Marginal Likelihood · Choosing the optimal bridge function.
This section presents the bridge sampling estimator of a model’s marginal likelihood, covering optimal bridge-function selection, proposal construction, posterior transformation, sample splitting, and iterative convergence. It emphasizes the method’s relatively relaxed proposal-tail requirements and practical use with default choices.
Method 4: The Bridge Sampling Estimator of the Marginal Likelihood
- Unlike importance sampling and generalized harmonic mean estimation, bridge sampling relaxes stringent tail-behavior requirements, benefiting estimation for high-dimensional posteriors.A moment-matched normal proposal often works, but may be unstable when a high-dimensional posterior is clearly non-normal.Source: Method 4: The Bridge Sampling… · pp. 16–17
- Bridge sampling approximates a single model’s marginal likelihood using samples from both a proposal distribution and the posterior distribution.The proposal should resemble the posterior and have sufficient overlap with it.Source: Method 4: The Bridge Sampling… · pp. 16–17
Choosing the optimal bridge function.
- The Meng–Wong optimal bridge function uses proposal and posterior sample proportions, and its normalizing constant cancels because it appears in both numerator and denominator.Meng and Wong (1996) proved that this function minimizes relative mean-squared error.Source: Choosing the optimal bridge function · p. 18
- Because the optimal bridge function depends on the unknown marginal likelihood, bridge sampling iteratively updates an initial estimate until convergence under a predefined tolerance.The iterative formula combines proposal and posterior samples to produce the next marginal-likelihood estimate.Source: Choosing the optimal bridge function · p. 18
- Bridge sampling remains robust to fatter or thinner proposal tails because its relevant ratios are bounded and tail samples cannot dominate the estimate.This robustness assumes sufficient proposal–posterior overlap; with no overlap, both sums are zero and the estimate is undefined.Source: Choosing the optimal bridge function · pp. 18–19
- The method addresses proposal-distribution transformation, use of N1 posterior samples, determination of constants s1 and s2 depending on N1 and N2, an initial marginal-likelihood guess, and iterative stopping at a predefined tolerance criterion.Source: Choosing the optimal bridge function · pp. 20, 23
- Using all posterior samples for proposal fitting and estimation may underestimate the marginal likelihood, so the procedure divides them into separate fitting and estimation batches.The tutorial uses two equally large batches: the first fits the proposal distribution, and the second computes the bridge sampling estimate.Source: Choosing the optimal bridge function · pp. 20–21
- Bridge sampling imposes less restrictive proposal-distribution requirements than importance sampling and the generalized harmonic mean estimator, enabling an almost automatic application with default choices.Source: Choosing the optimal bridge function · p. 21
- In the beta-binomial example, the method draws 2N1 = 24 samples from a Beta(3, 9) posterior, selects a normal proposal, probit-transforms samples to the real line, and fits it to the first batch of N1 transformed samples.Source: Choosing the optimal bridge function · pp. 21–22
Interim Summary … The Iowa Gambling Task
The tutorial establishes bridge sampling as its central marginal-likelihood estimator, then assesses its accuracy and applies it to the EV reinforcement-learning model and the Iowa Gambling Task. The IGT requires learning to prefer decks with positive long-term outcomes despite differing reward, loss, and loss-frequency profiles.
Interim Summary
- Bridge sampling is the tutorial’s most general estimator and is presented as particularly suitable for accurate marginal-likelihood estimation in hierarchical mathematical-psychology models.The preceding three estimators provide context for the bridge sampler, which is the focus of the remainder of the tutorial.Source: Interim Summary · p. 24
Assessing the Accuracy of the Bridge Sampling Estimate
- Accuracy is reported using the coefficient of variation, while repeated bridge-sampling runs are often impractical because posterior sampling and quantity evaluation are computationally burdensome.Under unbiasedness, the square root of expected relative mean-squared error can be interpreted as the coefficient of variation (Brown, 1998).Source: Assessing the Accuracy of the Bridge… · pp. 25–26
- The bridge-sampling accuracy measure accounts for independent proposal samples and potentially autocorrelated posterior MCMC samples.The autocorrelation adjustment uses the normalized spectral density of the posterior process.Source: Assessing the Accuracy of the Bridge… · p. 25
Case Study: Bridge Sampling for Reinforcement Learning Models
- The case study applies bridge sampling to the EV model using the Iowa Gambling Task dataset at both individual and hierarchical Bayesian levels.Individual-level estimates are compared with importance-sampling estimates, whereas hierarchical estimates are compared with Savage-Dickey density-ratio estimates.Source: Case Study: Bridge Sampling for… · p. 26
- The individual-level comparison uses importance-sampling estimates published in Steingroever, Wetzels, and Wagenmakers (2016), while the hierarchical comparison uses Savage-Dickey estimates.The Savage-Dickey comparison is associated with Dickey (1971), Dickey & Lientz (1970), Wagenmakers, Lodewyckx, Kuriyal, & Grasman (2010), and Wetzels, Grasman, & Wagenmakers (2010).Source: Case Study: Bridge Sampling for… · p. 26
The Iowa Gambling Task
- The IGT is a multi-round card game in which participants choose among four decks to maximize long-term net outcomes (Bechara et al., 1994; Bechara, Damasio, Tranel, & Damasio, 1997).Participants receive reward, loss, and cumulative net-outcome feedback after each choice, typically across 100 trials.Source: The Iowa Gambling Task · pp. 26–27
- Decks A and B are bad decks with high rewards but larger unpredictable losses, whereas C and D are good decks with lower rewards but smaller losses and positive long-term outcomes.Losses are frequent for decks A and C and infrequent for decks B and D; the task examines whether participants learn to prefer C and D.Source: The Iowa Gambling Task · p. 27
The Expectancy Valence Model … Assessing the accuracy of our implementation.
This section describes the three-parameter Expectancy Valence model and the bridge-sampling procedures used to estimate participant-specific marginal likelihoods. It reports the resulting estimates and their comparison with importance sampling, while discussing the method’s usefulness for hierarchical models.
Data
- The analysis uses data from 30 healthy participants, each contributing T = 100 IGT card selections, while excluding three participants with incomplete choice data.Source: Data · p. 29, Schematic execution of the bridge… · p. 29
EV Model
- The individual-level implementation estimates EV parameters separately for each participant and therefore produces a participant-specific marginal likelihood.Source: EV Model · p. 29
Schematic execution of the bridge sampler
- For each participant, bridge sampling reuses posterior draws, fits a multivariate-normal proposal after probit transformation, samples from it, and evaluates posterior-to-proposal quantities.The first batch contains 2N1 posterior samples; the proposal uses method-of-moments estimates, and the procedure then draws N2 proposal samples for likelihood evaluation.Source: Schematic execution of the bridge… · pp. 29–30
Schematic execution of the bridge sampler.
- After convergence, the procedure yielded a marginal-likelihood estimate and coefficient of variation for each participant.The iterative scheme ran until a predefined tolerance criterion was reached, using initialization and tolerance analogous to the running example.Source: Schematic execution of the bridge… · p. 31
- The largest coefficient of variation was 2.07%, indicating low variance in the bridge-sampler marginal-likelihood estimates.The coefficient of variation concerns marginal likelihoods rather than log marginal likelihoods.Source: Schematic execution of the bridge… · p. 31, Assessing the accuracy of our… · p. 31
Assessing the accuracy of our implementation.
- Both methods can estimate individual-participant marginal likelihoods, but bridge sampling is easier and more efficient for hierarchical models when suitable importance densities are difficult to find.The comparison used estimates from Steingroever et al. (2016).Source: Assessing the accuracy of our… · pp. 31–32
- Bridge- and importance-sampling log marginal-likelihood estimates corresponded almost perfectly across 30 participants, supporting a successful implementation.Figure 6 compares bridge sampling with importance sampling reported by Steingroever et al. (2016).Source: Assessing the accuracy of our… · pp. 31–32, Figure 6 · p. 32
Application of Bridge Sampling to a Hierarchical Implementation of the EV · Model · Discussion
This section applies bridge sampling to a hierarchical implementation of the EV model and discusses its accuracy, reliability, and practicality. It situates the method as useful for marginal likelihood estimation and broader Bayesian applications in mathematical psychology.
Model
- The hierarchical EV model represents participant parameters w, a, and c as draws from separate group-level distributions, combining between-participant differences and similarities.The application used the Busemeyer and Stout (2002) data set, treating its 30 participants as one group.Source: Model · pp. 32–33
- The sampler used converged hierarchical MCMC draws, a multivariate-normal proposal fitted to probit-transformed posterior samples, and the hierarchical likelihood-prior product for bridge estimation.All R-hat statistics were below 1.05, and the individual likelihood remained the same while group-level priors were additionally included.Source: Model · pp. 33–34
- Bridge-sampling Bayes factors closely approximated the Savage–Dickey Bayes factors of 1, while log marginal likelihoods also closely matched across the full and restricted EV models.These results support a successful implementation of the bridge sampler; Table 2 reports the comparisons.Source: Model · p. 36, Table 2 · p. 36
- The coefficient of variation for the marginal-likelihood estimates ranged from 9.71% to 16.44% across the full and three restricted models.This provides the reported confirmation that the bridge sampler had low variance in this application.Source: Model · p. 36
Discussion
- The tutorial demonstrates bridge sampling for marginal likelihoods in popular mathematical-psychology models, including individual-level and hierarchical implementations of the Expectancy Valence model (EV; Busemeyer & Stout, 2002).The beta-binomial model served as a step-by-step running example, alongside discussion of naive Monte Carlo, importance sampling, and generalized harmonic mean estimators as special cases.Source: Discussion · p. 36
- Bridge sampling is superior to naive Monte Carlo, importance sampling, and generalized harmonic-mean estimation because its optimal bridge function minimizes mean-squared error and is more robust to proposal-tail behavior.These properties facilitate application to higher-dimensional and complex models.Source: Discussion · p. 37
- Bridge sampling is an accurate, generic method that requires only minor code changes across models and is implemented in the bridgesampling R package to maximize accessibility.Typically, users adapt the unnormalized posterior and potentially the proposal function.Source: Discussion · p. 37
- Bridge sampling should not be used blindly because the best marginal-likelihood method balances accuracy and implementation effort according to model complexity, model count, researcher expertise, and available time.Analytical marginal likelihoods require no bridge sampling, while alternatives may be preferable for nested models, individual-level models, many simple models, or limited programming resources.Source: Discussion · p. 37
- Alternative methods have specific conditions: Savage-Dickey can be unstable in posterior tails, importance sampling needs a fat-tailed proposal, and BIC relies on a potentially unsuitable prior structure.Product-space or reversible-jump methods may suit many simple models, whereas path sampling may suit researchers with extensive programming and mathematical-statistical expertise.Source: Discussion · pp. 37–38
- The tutorial concludes that bridge sampling offers a reliable, easy-to-implement approach applicable to parameter estimation, model comparison, and Bayesian model averaging in mathematical psychology.Its genericity is positioned as useful across a wide range of mathematical-psychology problems.Source: Discussion · p. 38
Appendix A The Bridge Sampling Estimator as a General Case of Methods 1 – 3
This appendix shows that naive Monte Carlo, importance sampling, and generalized harmonic mean estimators are special cases of bridge sampling under specific choices of proposal distribution and bridge function. It summarizes these relationships and notes bridge sampling’s connection to the Chib and Jeliazkov (2001) method.
Appendix A The Bridge Sampling Estimator as a General Case of Methods 1 – 3
- Bridge sampling encompasses naive Monte Carlo, importance sampling, and generalized harmonic mean estimation through specific choices of g(θ) and h(θ).Table A1 summarizes the corresponding distributions and bridge functions.Source: Appendix A · p. 45, Table A1 · p. 45
- Naive Monte Carlo follows by setting g(θ) = p(θ) and h(θ) = 1/g(θ), yielding the estimator in Equation 7.These substitutions make the bridge sampling estimator algebraically equivalent to naive Monte Carlo.Source: Appendix A · pp. 45–46
- Bridge sampling is also a general case of the Chib and Jeliazkov (2001) method based on Metropolis-Hastings acceptance probabilities.The connection is noted with Meng & Schilling (2002) and Mira & Nicholls (2004).Source: Appendix A · p. 45
- Importance sampling follows by setting g(θ) = gIS(θ) and h(θ) = 1/g(θ), yielding the estimator in Equation 8.The specified proposal distribution and bridge function reduce bridge sampling to the importance sampling estimator.Source: Appendix A · p. 46
- The generalized harmonic mean estimator follows by setting g(θ) = gIS(θ) and h(θ) = 1/(p(y | θ) p(θ)), yielding Equation 9.This choice of bridge function makes the bridge sampling estimator equivalent to the generalized harmonic mean estimator.Source: Appendix A · pp. 46–47
Appendix B Bridge Sampling Implementation: Avoiding Numerical Issues
The implementation avoids numerical issues by rescaling the bridge-sampling calculation with a constant l∗ that keeps summed terms manageable. The iterative scheme can then operate on the rescaled quantity and recover either the marginal likelihood or its logarithm.
- A constant l∗ is chosen to keep the terms in the sums manageable during computation.Source: Appendix B · p. 48
- The iterative scheme is run with respect to the rescaled quantity ˆr, improving numerical convenience by keeping summed terms manageable.Source: Appendix B · p. 49
- Multiplying the result by exp(l∗) yields an estimate of the marginal likelihood, while adding l∗ to its logarithm yields the log marginal likelihood.Source: Appendix B · p. 49
Appendix C Correcting for the Probit Transformation
This appendix explains how the probit transformation changes the generalized harmonic mean estimator and how the transformed importance density is incorporated. It also shows that the estimator can use either original or probit-transformed posterior samples, with the code using the latter.
- The probit transformation modifies the generalized harmonic mean estimator from Equation 9 to Equation 10.Source: Appendix C · p. 49
- The running example uses a normal importance density on ξ, where ξ = Φ−1(θ), requiring the density to be rewritten in terms of θ.Source: Appendix C · p. 49
- The rewritten importance density includes a change-of-variable factor when substituted into the generalized harmonic mean expression.Source: Appendix C · p. 49
- The generalized harmonic estimate can use posterior samples or probit-transformed posterior samples; the provided code uses the latter (see also Overstall & Forster, 2010).Source: Appendix C · p. 50
Appendix D Details on the Application of Bridge Sampling to the Individual-Level EV Model
This appendix details computation of the unnormalized posterior for an individual participant in the EV model. The implementation uses an iterative scheme and log-scale calculations to avoid numerical issues.
Appendix D Details on the Application of Bridge Sampling to the Individual-Level EV Model
- For a specific participant s ∈ {1, 2, . . . , 30}, the derivation drops the participant subscript for the remainder of the computation.Source: Appendix D · p. 50
- The bridge-sampling iterative scheme is run with respect to ˆr to avoid numerical issues when computing log(l1,j) and log(l2,i).For proposal samples ˜κi = (˜ωi, ˜αi, ˜γi), log(l2,i) is computed explicitly, with log(l1,j) handled analogously.Source: Appendix D · p. 50
- Rather than computing the unnormalized posterior distribution directly, the method computes its logarithm as the sum of likelihood, prior, and proposal-density log terms.Source: Appendix D · p. 51
Appendix E Details on the Application of Bridge Sampling to the Hierarchical EV Model
This appendix describes how the logarithm of the unnormalized posterior was obtained for the hierarchical implementation of the EV model using bridge-sampling proposal draws.
Appendix E Details on the Application of Bridge Sampling to the Hierarchical EV Model
- The hierarchical EV implementation computes the logarithm of its unnormalized posterior analogously to the preceding section.Source: Appendix E · p. 51
- For each proposal draw, the calculation uses individual-level parameters κ̃_s,i and group-level parameters ζ̃_i.The group-level vector is ζ̃_i = (μ̃_ω,i, τ̃_ω,i, μ̃_α,i, τ̃_α,i, μ̃_γ,i, τ̃_γ,i).Source: Appendix E · p. 51