---
title: "bridgesampling — paper by Gronau et al. (2020)"
description: "How the bridgesampling R package estimates marginal likelihoods, supports Bayesian comparisons, and measures numerical uncertainty."
canonical: "https://research.elamur.ai/free/en/papers/gronau-2020-bridgesampling-r-package-estimating-normalizing/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/gronau-2020-bridgesampling-r-package-estimating-normalizing/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2020](https://md.research.elamur.ai/free/en/papers/2020/) / bridgesampling: An R Package for Estimating Normalizing Constants

# bridgesampling: An R Package for Estimating Normalizing Constants

Paper · 2020 · Quentin F. Gronau, Henrik Singmann and Eric‐Jan Wagenmakers

**Authors:** Quentin F. Gronau, Henrik Singmann and Eric‐Jan Wagenmakers · **Year:** 2020 · **Venue:** Journal of Statistical Software · **Licence:** [arXiv — non-exclusive license to distribute](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

[**222** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W2767152246|W3008266717|W4300028207|W6906324646|W6980342357|W7110602815) · Journal of Statistical Software · [licence](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

- [DOI 10.18637/jss.v092.i10](https://doi.org/10.18637/jss.v092.i10)
- [arXiv 1710.08162](https://arxiv.org/abs/1710.08162)
- [OpenAlex](https://openalex.org/W3008266717)

## Deep dive: bridgesampling: An R Package for Estimating Normalizing Constants

How the bridgesampling R package estimates marginal likelihoods, supports Bayesian comparisons, and measures numerical uncertainty. · about 33 minutes to read

**In this deep dive**

1. [Summary](#dd-summary)
2. [Ideas worth borrowing](#dd-ideas-worth-borrowing)
3. [How Mova uses it](#dd-how-mova-uses-it)
4. [The problem and its context](#dd-the-problem-and-its-context)
5. [The method, step by step](#dd-the-method-step-by-step)
6. [Experiments and results](#dd-experiments-and-results)
7. [What the ablations show](#dd-what-the-ablations-show)
8. [Limitations](#dd-limitations)
9. [What came after](#dd-what-came-after)

### Summary

Bayesian inference often begins with a quantity that can be evaluated but cannot easily be turned into a probability distribution. A researcher can calculate how well a particular parameter setting explains the observations and how plausible that setting was beforehand. What remains difficult is calculating the total probability mass across all possible settings. That total is the normalizing constant. For estimating parameters, sampling methods can frequently work around its absence. For comparing competing explanations of the data, however, the constant becomes essential. The bridgesampling paper presents an R package that makes this calculation more accessible through bridge sampling, a method that combines posterior draws with draws from a convenient auxiliary distribution.

In Bayesian applications, the normalizing constant is called the marginal likelihood. It measures the probability of the observations after averaging over a model’s parameter distribution before seeing the data. Ratios of marginal likelihoods give Bayes factors, which describe how the observations change the relative support for competing accounts. Marginal likelihoods also enter posterior probabilities over a collection of candidates. The package therefore addresses a practical gap between fitting a Bayesian analysis and comparing it with alternatives. Its general interface accepts posterior samples, a function evaluating the unnormalized log posterior, the observations and other necessary information, and parameter bounds. An interface to Stan extracts most of this information automatically, provided that the statistical specification preserves the probability constants needed for evidence calculations.

The package implements a normal proposal and a more elaborate Warp-III procedure. The normal approach fits a multivariate Gaussian distribution to transformed posterior samples, matching their mean and covariance. Warp-III instead reshapes the posterior to improve its agreement with a standard Gaussian proposal, including a correction for skewness. Both approaches depend on overlap between the distributions used in the calculation. The paper also separates different kinds of numerical uncertainty: approximate error measures, repeated bridge calculations using the same posterior samples, and repetitions that obtain new posterior samples as well. That distinction matters because a stable calculation on an unrepresentative sample can still give a misleading answer.

The demonstrations recover established results in a paired-samples sleep experiment, a turtle-survival analysis, and a factor analysis of exchange-rate changes. For the sleep comparison, bridge sampling produces a Bayes factor of 17.26001, close to the reference value of 17.259. For the turtle analysis, it produces 1.27151 against a numerical-integration reference of 1.273. In the exchange-rate example, the analysis favors the candidate with two latent factors while retaining support for the alternative with three. These examples establish useful agreement with reference calculations and show how the interfaces work in practice. They do not establish that every posterior distribution is easy to handle. The authors emphasize representative samples, adequate simulation effort, uncertainty assessment, careful prior choices, and the remaining difficulty of distributions with several modes.

### Ideas worth borrowing

Separate fitting from evidence calculation. The package takes posterior samples produced elsewhere and uses them in a subsequent computation. This lets researchers retain an established sampling workflow rather than replace it with an entirely different inference procedure. The broader engineering lesson is to define a clear boundary between generating a useful intermediate representation and calculating a new quantity from it. Such a boundary supports reuse: a specialized sampler can remain specialized, while a general evidence estimator operates on a shared interface.

Improve overlap before increasing computation. Bridge sampling becomes more accurate when the posterior and proposal distributions cover similar regions. The normal method matches location and covariance; Warp-III additionally addresses skewness. This suggests a general numerical strategy: before asking for more samples, examine whether the distributions being compared are poorly aligned. Better coordinates or a better auxiliary distribution may make each evaluation more informative. The same principle applies whenever an estimator depends on moving information between distributions rather than evaluating a single expectation directly.

Preserve the quantity under transformation. The package changes parameter coordinates while including the corresponding Jacobian adjustment. Warp-III goes further by altering the posterior’s shape while retaining the normalizing constant of interest. The reusable idea is to identify what must remain invariant, then change the representation to make computation easier. This is useful in probabilistic software because the most natural scientific parameterization is not always the most convenient numerical one. A correct transformation connects the two without changing the target calculation.

Keep adaptation separate from evaluation. The authors warn that using the same posterior draws to fit the proposal and to run the bridge calculation can bias the evidence estimate downward. The implementation therefore divides each chain, using one portion to construct the proposal and another in the estimating equation. This is a practical example of a wider problem: data used to adapt a computational device should not automatically be treated as independent evidence for assessing that device. Separating those roles can improve reliability without changing the underlying scientific question.

Describe what an uncertainty estimate includes. Repeating the bridge calculation while retaining the posterior samples measures a narrower source of variability than repeating the entire workflow. The former changes proposal draws; the latter also changes the posterior draws on which the calculation depends. This distinction transfers directly to experimental design and software evaluation. A reported spread is meaningful only when readers know which parts of the process were rerun and which were held constant. Conditional stability should not be presented as uncertainty about the whole procedure.

Automate bookkeeping without concealing assumptions. The Stan interface removes much of the work involved in extracting samples, handling constraints, and evaluating densities. Yet it cannot choose scientifically meaningful priors or ensure that a posterior sample represents the intended distribution. The useful design principle is to automate operations that can be checked mechanically while keeping consequential assumptions visible. Convenience is most valuable when it reduces transcription errors and repetitive work without making the scope of the result harder to inspect.

### How Mova uses it

For Mova, the small transparent language system written in Rust, the paper offers a possible approach to evidence calculation rather than a demonstrated component. No Mova implementation or experiment is established by this work. The connection is most concrete when a language-system component has an explicitly defined probabilistic analysis, continuous unknown parameters, an evaluable density, and a way to obtain representative posterior samples. Under those conditions, bridge sampling could help compare alternative statistical accounts while preserving a record of the assumptions behind each comparison.

One possible application would be comparing alternative explanations for linguistic observations within a bounded component. Instead of selecting an account solely because its best parameter setting fits the observations well, an evidence calculation would average over its prior parameter distribution. The paper explains why that distinction matters: marginal likelihoods incorporate how probability is distributed across possible settings, rather than considering only a favorable setting. For Mova, this could support transparent comparisons where the likelihood, prior, parameter bounds, and numerical uncertainty are all available for inspection. It would require a suitable probabilistic formulation; the paper does not supply one for language processing.

A Rust implementation could also borrow the package’s separation of responsibilities. A sampler would produce posterior draws, a density evaluator would retain the required constants, and a bridge-sampling component would estimate the normalizing constant. Constraint transformations would belong to an explicit layer with Jacobian adjustments. Repeated calculations could record whether posterior samples were reused or regenerated. These are architectural possibilities, not claims about functionality already built into Mova. Their value would be clearer [interpretability](https://md.research.elamur.ai/free/en/topics/interpretability/) of the numerical workflow: a reviewer could trace an evidence estimate back to its inputs and assumptions.

The limits are especially relevant to a language system. The package described in the paper does not directly support discrete unknown parameters. If a proposed linguistic analysis includes discrete latent choices, those choices would need to be integrated out where feasible before using this procedure. Nor does the paper show that normalizing constants solve language understanding, establish the correctness of a linguistic representation, or provide a general confidence score for a system’s output. The defensible borrowing is narrower: evidence estimation for suitable probabilistic components, together with disciplined reporting of prior dependence and simulation uncertainty.

### The problem and its context

A probability density must assign a total mass of one over its domain. In many statistical problems, the available expression has the right relative shape but not the required total. It may say that one parameter setting is more plausible than another without giving either setting a properly normalized density. Turning that expression into a probability distribution requires integration across all permitted parameter values.

The paper writes the general problem as:

```
Z = ∫_Θ q(θ) dθ
```

Here, Z is the normalizing constant, q is the non-negative expression being integrated, θ is the parameter vector, and Θ is its allowed domain. The differential dθ indicates integration over that vector. The paper allows Θ to be a subset of a real-valued parameter space, so restrictions on parameters are part of the problem instead of an exceptional case.

The normalized density is:

```
p(θ) = q(θ) / Z
```

The function p is now a probability density. Dividing q by Z preserves relative density values while making the total mass equal to one. The task is therefore not to discover a different distributional shape. It is to determine the scale required to interpret the existing expression probabilistically.

The authors place this problem in a wider statistical setting. They mention applications involving physical free energies, missing observations in likelihood-based inference, Bayes factors, and averaging across Bayesian alternatives. Their software is intended for normalizing constants generally, although the article concentrates on Bayesian evidence.

#### Why sampling is not enough for comparison

In Bayesian inference, the unnormalized posterior is the product of a likelihood and a prior density. The likelihood describes the observations conditional on parameters. The prior describes parameter uncertainty before those observations are incorporated. Sampling methods can frequently explore the resulting posterior without calculating its integral. This makes parameter estimation possible even when the normalizing constant remains unknown.

That computational escape does not carry over automatically to comparison. A posterior sample describes uncertainty within a specified account. It does not, on its own, supply the probability of the observations under that account. The latter requires integrating over its prior parameter distribution:

```
p(y | Mᵢ) = ∫_Θ p(y | θ, Mᵢ) p(θ | Mᵢ) dθ
```

The observations are y, Mᵢ is a particular candidate, and θ contains its unknown parameters. The first term inside the integral is the likelihood; the second is the prior density. The integral p(y | Mᵢ) is the marginal likelihood. Its dependence on the prior is explicit: parameter settings contribute according to the probability assigned to them before conditioning on y.

The paper connects this averaging to parsimony. An account is not evaluated only at a parameter setting that explains the observations particularly well. Its evidence reflects how the likelihood behaves across the prior distribution. This is why the marginal likelihood can express a preference for a more constrained explanation even when a more flexible alternative can fit the observations closely.

For a collection of candidates, the evidence enters the posterior probability as follows:

```
p(Mᵢ | y) = p(y | Mᵢ) p(Mᵢ) / Σⱼ₌₁ᵐ p(y | Mⱼ) p(Mⱼ)
```

The quantity p(Mᵢ) is the prior probability assigned to candidate Mᵢ, and m is the number of candidates under consideration. The denominator adds the evidence-weighted prior probabilities across that collection. The result p(Mᵢ | y) is the probability of Mᵢ after observing y, conditional on the alternatives included in the comparison.

For a pair of candidates, the same update is particularly easy to express through odds:

```
p(M₁ | y) / p(M₂ | y) = [p(y | M₁) / p(y | M₂)] × [p(M₁) / p(M₂)]
```

The left side gives posterior odds. The final bracket gives prior odds. The intervening ratio of marginal likelihoods is the Bayes factor. It measures the multiplicative change in relative support brought about by the observations. This distinguishes a Bayes factor from a posterior probability: the latter also depends on the probabilities assigned to the competing candidates beforehand.

#### The computational landscape described by the authors

For relatively simple cases, the required integral can be solved analytically. For more elaborate structures, including hierarchical analyses, it becomes a high-dimensional numerical problem. The paper treats this difficulty as a longstanding obstacle to practical Bayesian comparison.

Earlier approaches include direct Monte Carlo averaging, importance sampling, and generalized harmonic-mean estimation. The article also names methods that organize the comparison more explicitly, such as reversible-jump simulation and the product-space approach. Other possibilities include Chib’s method, thermodynamic integration, and path sampling. The authors present these as methods with different tradeoffs in implementation effort, computational cost, and accuracy. They do not report a comprehensive experimental ranking of them.

Bridge sampling is attractive in this setting because it can reuse posterior draws and does not require the researcher to construct a bespoke algorithm that moves between competing parameter spaces. The authors trace the bridge identity to Meng and Wong and the warping approach to Meng and Schilling. Their main contribution is not the original mathematical identity. It is a practical implementation that combines established bridge-sampling ideas with transformations, numerical safeguards, uncertainty measures, and interfaces to existing inference software.

The desired user experience is straightforward: obtain posterior samples with an appropriate sampler, supply enough information to evaluate the relevant density correctly, and receive a log marginal-likelihood estimate. The package supports several forms of sample object, including outputs associated with JAGS and Stan. It also permits a matrix of draws, which preserves compatibility with custom sampling procedures.

The distinction between generality and automation remains important. A general interface can serve many statistical specifications while still requiring careful manual density coding. A more automatic interface becomes possible when the fitting software already exposes the necessary transformations and density evaluator. Much of the paper’s practical argument concerns how to make that second arrangement work without losing the constants on which evidence depends.

### The method, step by step

The workflow starts after a statistical specification has been chosen and posterior sampling has been carried out. Bridge sampling is not a training algorithm, and the paper does not introduce a new procedure for learning parameters. Its task is to calculate a normalizing constant from a fitted analysis and an evaluable unnormalized density.

The general interface to `bridge_sampler` requires posterior draws through `samples`, a log-density evaluator through `log_posterior`, the observations and supporting information through `data`, and parameter limits through `lb` and `ub`. These inputs serve distinct purposes. The draws show where posterior mass lies. The density evaluator supplies numerical values at both posterior and proposal locations. The bounds allow the package to choose valid coordinate transformations.

From posterior samples to Bayesian evidence The steps in order.

#### Connect the unknown density to a known distribution

The central construction combines the posterior with an auxiliary distribution whose density is normalized and easy to evaluate. This auxiliary distribution is called the proposal. The term does not imply that it must generate the posterior sampling process. Here, it supplies another set of draws for a later calculation.

Let g be the proposal density and h a bridge function. The population identity is:

```
p(y) = E_g[h(θ) p(y | θ) p(θ)] / E_p(θ|y)[h(θ) g(θ)]
```

The marginal likelihood is p(y), with the candidate label suppressed for readability. The notation E_g means an expectation under the proposal distribution. The denominator is an expectation under the posterior p(θ | y). The terms p(y | θ) and p(θ) are the likelihood and prior. The function h connects the two expectations.

This identity is useful because its ingredients can be evaluated without knowing p(y) in advance. The posterior distribution can be sampled using an appropriate inference algorithm. The proposal can be sampled directly. The unnormalized posterior can be calculated as the likelihood multiplied by the prior. The unknown normalizing constant is recovered from the relationship between the resulting expectations.

With finite samples, the estimator becomes:

```
p̂(y) = [(1/n₂) Σⱼ₌₁ⁿ² h(θ̃ⱼ) p(y | θ̃ⱼ) p(θ̃ⱼ)] / [(1/n₁) Σᵢ₌₁ⁿ¹ h(θᵢ*) g(θᵢ*)]
```

The hat marks an estimate. There are n₂ proposal draws, written θ̃ⱼ, and n₁ posterior draws, written θᵢ*. The numerator averages quantities evaluated at proposal locations; the denominator averages quantities evaluated at posterior locations. The estimator therefore uses information from both distributions instead of relying completely on either one.

The reason for seeking substantial overlap is now visible. If the proposal spends most of its time where the posterior density is negligible, or misses important posterior regions, the two averages have less useful information in common. The package addresses this by fitting the proposal to the posterior or transforming the posterior to resemble a fixed proposal.

#### Choose the bridge function and iterate

The package uses the bridge-function choice that the paper attributes to Meng and Wong. Its purpose is to minimize relative mean-squared estimation error. This choice leads to an updating equation because the expression depends on the normalizing constant being estimated.

The calculation first forms likelihood-prior ratios relative to the proposal at posterior draws:

```
l₁,ᵢ = p(y | θᵢ*) p(θᵢ*) / g(θᵢ*)
```

Here, l₁,ᵢ is the unnormalized posterior density divided by the proposal density at posterior sample θᵢ*. The same type of ratio is calculated at proposal draws:

```
l₂,ⱼ = p(y | θ̃ⱼ) p(θ̃ⱼ) / g(θ̃ⱼ)
```

The quantity l₂,ⱼ uses proposal sample θ̃ⱼ instead. The distinction between the two collections concerns where the density ratio is evaluated, not a different definition of the underlying likelihood or prior.

Starting with an initial estimate, the algorithm updates it through:

```
p̂(y)⁽ᵗ⁺¹⁾ = [(1/n₂) Σⱼ₌₁ⁿ² l₂,ⱼ / (s₁ l₂,ⱼ + s₂ p̂(y)⁽ᵗ⁾)] / [(1/n₁) Σᵢ₌₁ⁿ¹ 1 / (s₁ l₁,ᵢ + s₂ p̂(y)⁽ᵗ⁾)]
```

The superscript t labels the current iteration, and t + 1 labels the next. The quantities s₁ and s₂ weight the posterior and proposal contributions in the bridge calculation. The sample counts and density ratios retain their earlier meanings. The updating continues until the estimate converges.

An important computational feature is that the density ratios need not be recalculated at every iteration. They are evaluated before the updating begins. The authors report that these evaluations typically dominate computation, whereas the subsequent numerical iteration is comparatively inexpensive.

Those evaluations can also run independently. Once the sample locations exist, calculating a density ratio at one location does not require the result from another. The `cores` setting enables parallel evaluation. This is a different kind of parallelism from generating a sequential Markov chain: it distributes already-defined density calculations across workers.

The implementation does not rely on the displayed arithmetic in its raw form. It uses logarithms and the Brobdingnag package to protect the calculation against numerical underflow and overflow. This matters because products of many probability densities can be extremely small even when their relative values remain informative.

#### Transform parameters without changing the evidence

A multivariate normal proposal lives on an unconstrained real-valued space. Many statistical parameters do not. Variances must remain positive, probabilities stay within bounds, and other parameter types can have joint restrictions.

The package handles common restrictions by transforming θ to a new vector ξ through a differentiable invertible function f. The posterior density in the new coordinates is:

```
p(ξ | y) = p_θ(f⁻¹(ξ) | y) |det J_f⁻¹(ξ)|
```

The function f⁻¹ maps transformed coordinates back to the original parameters. The term p_θ denotes the original posterior density evaluated at those recovered values. The matrix J_f⁻¹ contains derivatives of the inverse transformation. Its determinant measures how the transformation changes local volume, and the absolute value ensures a non-negative density adjustment.

The Jacobian term is essential. Transforming only the sample locations would change the geometry without making the corresponding correction to the density. With the correction included, the transformed distribution retains the normalizing constant sought in the original coordinates.

For parameters transformed independently, the Jacobian matrix is diagonal, giving:

```
|det J_f⁻¹(ξ)| = ∏ᵢ₌₁ᵖ |∂θᵢ / ∂ξᵢ|
```

The index i runs across the p parameter components. Each derivative describes how an original component changes with its transformed counterpart. The product replaces a more general determinant calculation because there are no cross-component derivatives in this case.

The built-in transformations leave unrestricted parameters unchanged. A parameter restricted on one side receives a logarithmic transformation. A parameter restricted above and below receives a probit transformation. The package applies the corresponding Jacobian adjustment internally, allowing users to describe the statistical specification in familiar coordinates.

The paper also notes support for simplex and circular parameters. Through Stan, the package can use a richer collection of transformations, including those required for covariance and correlation matrices. These capabilities extend the constraint handling, but they do not remove the need for a correct density in the transformed space.

#### Fit a normal proposal

The default setting, called `normal`, fits a multivariate Gaussian proposal after constrained parameters have been transformed. Its mean and covariance are estimated from posterior draws using moments.

Matching covariance is important because the posterior need not vary independently along its coordinate axes. If parameters are strongly related, a proposal that ignores those relations may place many draws in regions with little posterior mass. A full covariance matrix allows the proposal to follow the main orientation and scale of the posterior sample.

The package does not use all posterior draws for every purpose. Each chain is divided into halves. The earlier portion fits the proposal, and the later portion enters the bridge estimator. The authors adopt this separation because reusing the same observations for proposal fitting and bridge evaluation can lead to underestimation of the marginal likelihood.

This arrangement is a safeguard against a particular reuse effect. It does not establish that the original chains have converged, that their tails are well represented, or that every important region has been visited. Those remain requirements on the posterior sampling stage.

#### Use Warp-III when skewness matters

The alternative `warp3` setting changes the posterior instead of fitting a general Gaussian proposal to it. The proposal is fixed as a standard multivariate normal distribution. The posterior is centered, rescaled, and symmetrized so that the two distributions agree more closely.

The transformation is:

```
η = b R⁻¹(ξ − μ)
```

The vector ξ contains unconstrained parameter values. Its mean is μ. The matrix R comes from a Cholesky factorization of the covariance matrix. The variable b is a random sign, taking values −1 and 1 with probability 0.5. The transformed vector is η.

The covariance factorization is:

```
Σ = R Rᵀ
```

Here, Σ is the covariance matrix of ξ, and Rᵀ is the transpose of R. Subtracting μ centers the posterior, while multiplication by R⁻¹ adjusts its covariance to the identity matrix. The random sign then makes the resulting distribution symmetric.

The paper’s univariate illustration explains the same operation in simpler terms. Posterior samples are moved to mean zero and variance one, then randomly reflected. A skewed original distribution thereby becomes symmetric around zero. The multivariate version applies the corresponding operation jointly.

Warp-III matches mean, covariance, and skewness with the standard Gaussian proposal. In the authors’ view, its precision should match or exceed that of the normal method, and it should have an advantage when the transformed posterior is skewed. When symmetry is already present, the expected efficiency is similar.

That benefit has a cost. The warped density is a mixture requiring more evaluations of the unnormalized posterior. The authors describe its execution time as about twice that of the normal approach. Choosing between the methods therefore concerns precision per available computational budget, not simply a preference for the more elaborate procedure.

#### Preserve constants in the density evaluator

The density supplied to bridge sampling must be unnormalized only with respect to the unknown posterior normalizer. It must still retain the known constants in the likelihood and prior distributions.

This distinction is easy to miss. Some constants can be ignored while sampling parameters because they do not change relative posterior density. Those same constants affect the integral being estimated. A sampler may therefore behave correctly even when the expression it uses would give the wrong marginal likelihood.

For JAGS and custom samplers, the paper describes a heuristic for assembling the log posterior: identify the stochastic distribution statements, evaluate the associated log densities, and add them. The heuristic requires care when sampling includes additional generated quantities, such as posterior predictions, because not every random quantity belongs in the target density for the evidence calculation.

For Stan, the interface extracts unconstrained draws and the log density automatically. The statistical specification must nevertheless use density expressions that keep the necessary constants. The paper contrasts ordinary sampling notation with explicit log-density accumulation. It also explains that truncated distributions require their own normalization adjustments.

For an upper-truncated Gaussian variable, the required log-density expression has the form:

```
log p(y | μ, σ, y ≤ u) = log Normal(y | μ, σ) − log Φ((u − μ)/σ)
```

The value y is the bounded variable, μ and σ are the Gaussian location and scale, and u is the upper limit. The function Φ is the standard normal cumulative distribution function. The subtraction accounts for the probability mass retained below the limit.

For lower truncation, the corresponding expression is:

```
log p(y | μ, σ, y ≥ l) = log Normal(y | μ, σ) − log [1 − Φ((l − μ)/σ)]
```

The lower limit is l. The complementary cumulative probability gives the Gaussian mass remaining above that bound. For truncation at both ends, the retained mass is the difference between the cumulative probabilities at the limits.

The paper emphasizes stable computation of such differences and correct declaration of parameter bounds. It also notes that a normalization term must be applied with the appropriate multiplicity when a distribution describes several observations. Automation cannot recover a normalization factor that the statistical specification has omitted.

#### Assess numerical uncertainty

For a single calculation using the normal method, the package offers an approximate relative mean-squared error:

```
RE² = E[(p̂(y) − p(y))²] / p(y)²
```

The estimate is p̂(y), the true marginal likelihood is p(y), and E averages over the estimator’s randomness. Division by the squared target makes the measure relative to the magnitude of the evidence.

The approximation accounts for independent proposal draws and potentially autocorrelated posterior draws. Under an unbiasedness assumption, its square root can be read as a coefficient of variation: standard deviation relative to the mean. The package also expresses that quantity as a percentage.

For a single Warp-III calculation, these approximate errors are unavailable because the authors found them unreliable. Repetitions provide an alternative. The `repetitions` argument reruns the bridge computation with newly drawn proposal samples while retaining the posterior sample. The output then includes the range and interquartile spread of log-evidence estimates.

A more complete assessment reruns posterior sampling too. The authors recommend that approach when resources permit because it includes uncertainty from both sets of draws. They also suggest assessing variability in the final quantity of interest. If a Bayes factor is the scientific result, repeating the full comparison is more directly informative than inspecting an error measure for only one marginal likelihood.

### Experiments and results

The empirical section combines software demonstrations with checks against previously established Bayesian calculations. Its [evaluation and benchmarks](https://md.research.elamur.ai/free/en/topics/evaluation-benchmarks/) concern numerical agreement, estimated error, and the interpretation of evidence. The paper does not present a broad runtime competition across all marginal-likelihood estimators.

The examples become progressively more involved. The sleep analysis checks a small paired comparison through the general interface. The turtle analysis demonstrates automatic extraction from Stan for a hierarchical regression. The exchange-rate analysis uses Warp-III, repeated calculations, constrained loadings, and posterior probabilities over alternative factor structures.

#### Sleep measurements: agreement in a paired comparison

The sleep data record the effects of different drugs on the same ten patients. The outcome is additional sleep relative to a control night. Because the patients receive both drugs, the analysis works with within-patient differences instead of treating the drug groups as unrelated samples.

Under the null account, the differences have a Gaussian distribution centered at zero:

```
dᵢ ~ N(0, σ²)
```

The variable dᵢ is the sleep difference for patient i, and σ² is the variance of those differences. Under the alternative, the mean depends on a standardized effect:

```
dᵢ ~ N(σδ, σ²)
```

The parameter δ is the standardized effect size, and σ is the standard deviation. Expressing the mean as σδ connects the raw sleep difference to the scale of variation across patients.

The theoretical description assigns the variance a Jeffreys prior:

```
p(σ²) ∝ 1/σ²
```

The proportionality sign indicates that the expression gives the prior’s shape instead of a normalized density. The effect size receives a zero-centered Cauchy prior with scale:

```
r = 1/√2
```

The symbol r is the Cauchy scale parameter. The actual JAGS density evaluator shown in the paper uses a gamma prior on precision with parameters 0.0001 and 0.0001. Keeping the theoretical description and implemented density distinct matters because bridge sampling integrates the density actually supplied to it.

Posterior draws are obtained with JAGS. The reported settings use 3 chains, 16,000 iterations, a burn-in of 1000, and thinning of 1. The authors deliberately use substantial posterior sampling effort, noting that evidence calculations can need appreciably more draws than ordinary parameter summaries.

For the alternative account, the normal bridge method returns a log marginal likelihood of −27.17103 after 5 updating iterations. The reported approximate relative mean-squared error is 7.564225e-07, the coefficient of variation is 0.0008697255, and the corresponding percentage error is 0.087. These quantities describe estimated numerical uncertainty in the evidence calculation.

After estimating the null evidence as well, the package forms the Bayes factor in favor of a non-zero effect:

Sleep data, Bayes factor favoring a drug difference Bridge sampling closely agrees with the reference calculation.

**The numbers**

| System or setting | Bayes factor BF10 |
| --- | --- |
| BayesFactor reference | 17.259 |
| bridgesampling normal (this paper) | 17.26001 |

The chart compares numerical estimates of the same evidential quantity. Its direction indicates stronger support for the alternative as the Bayes factor increases; it should not be read as rewarding an estimator for producing a larger value. Accuracy here means agreement with the reference, not maximizing the Bayes factor.

The substantive interpretation is conditional on the hypotheses and priors used. The observations support the alternative over the zero-effect account. The computational interpretation is narrower: the package recovers the established result closely in a setting where a separate calculation is readily available.

#### Turtle survival: a hierarchical regression check

The turtle data contain 244 newborn animals from 31 clutches. Each record includes survival status, birth weight, and clutch membership. The scientific comparison concerns whether survival requires an additional clutch-level effect after accounting for weight.

The observation distribution is:

```
yᵢ ~ Bernoulli(Φ(α₀ + α₁xᵢ + b_clutchᵢ))
```

The survival indicator is yᵢ, and xᵢ is birth weight in grams. The intercept is α₀, the weight coefficient is α₁, and b_clutchᵢ is the effect associated with the turtle’s clutch. The standard normal cumulative distribution function Φ turns the linear predictor into a survival probability.

Clutch effects follow:

```
bⱼ ~ N(0, σ²)
```

The index j identifies a clutch, and σ² describes variation among clutch effects. The null comparison fixes this variance to zero. The alternative allows it to vary under a prior.

The regression coefficients receive Gaussian priors:

```
α₀ ~ N(0, 10)
```

The parameter α₀ is the intercept. The distribution notation retains the prior specification used by the paper. The weight coefficient has the corresponding prior:

```
α₁ ~ N(0, 10)
```

The alternative’s variance prior is:

```
p(σ²) = (1 + σ²)⁻²
```

The parameter σ² is non-negative. This prior, together with the coefficient priors, defines the evidence comparison reproduced from the earlier analysis.

The authors fit the alternatives in Stan using 15,500 iterations, warmup of 500, and 4 chains. The resulting fit objects can be passed directly to `bridge_sampler`; no separate hand-written density function is needed at this stage.

The earlier study reported a numerical-integration reference of 1.273 for the Bayes factor favoring the absence of clutch variation. The package gives:

Turtle survival, Bayes factor favoring no clutch effect The automated Stan workflow reproduces the numerical-integration reference closely.

**The numbers**

| System or setting | Bayes factor BF01 |
| --- | --- |
| Numerical-integration reference | 1.273 |
| bridgesampling normal (this paper) | 1.27151 |

Again, higher values mean greater support for the stated null comparison, rather than better numerical performance. The close correspondence is the relevant validation result.

The estimated percentage errors are 0.00972 for the null evidence and 0.348 for the random-effects evidence. The more elaborate alternative is therefore estimated less precisely in this example, although both reported errors are small.

The scientific result is restrained. A Bayes factor near the reported values does not provide strong evidence about whether clutch membership affects survival. This example separates numerical accuracy from decisive inference: a comparison can be computed accurately while the observations remain only weakly informative between the alternatives.

#### Exchange rates: choosing a latent-factor structure

The final analysis uses monthly exchange-rate changes relative to pounds sterling, covering January 1975 through December 1986. The series include North American and European currencies alongside the Japanese yen. Each series is standardized using its sample mean and standard deviation.

The statistical question concerns the number of latent factors needed to account for dependence among the observed variables. The authors compare structures with one, two, and three factors, following the specification used by Lopes and West.

Conditional on latent factors, an observation follows:

```
yₜ | fₜ ~ Nₘ(βfₜ, Σ)
```

The vector yₜ contains the m observed variables at occasion t. The latent vector fₜ contains k factor values. The loading matrix β maps those factor values into observed-variable space. The matrix Σ is diagonal and contains residual variances, so the observed variables are conditionally uncorrelated after accounting for the factors.

The factors have a standard multivariate Gaussian distribution:

```
fₜ ~ Nₖ(0ₖ, Iₖ)
```

The vector 0ₖ contains zeros, and Iₖ is the identity matrix. Integrating out the factors gives:

```
yₜ ~ Nₘ(0ₘ, Ω)
```

The marginal covariance is:

```
Ω = ββᵀ + Σ
```

The transpose is marked by the superscript T. The term ββᵀ represents covariance induced by shared factors, while Σ supplies variable-specific residual variation.

Identification restrictions make β lower-triangular. Its diagonal entries are positive and receive standard half-normal priors; entries below the diagonal receive standard normal priors. The diagonal prior is written as:

```
βⱼⱼ ~ N(0, 1) truncated below at 0
```

The index j identifies a diagonal loading. The truncation makes the loading positive and requires the correct normalization in the evidence calculation.

Residual variances use:

```
σᵢ² ~ Inverse-Gamma(ν/2, νs²/2)
```

The parameter σᵢ² is the residual variance of observed variable i. The hyper-parameters satisfy ν = 2.2 and νs² = 0.1. These are inherited from the earlier factor-analysis study so that the evidence calculations can be compared under the same specification.

The Stan settings use 11,000 iterations, warmup of 1000, and 4 chains. Evidence is estimated with `warp3`, using `repetitions = 10` and `cores = 4`. The repetitions provide an empirical assessment conditional on the posterior samples.

For the two-factor candidate, the reported log marginal-likelihood estimate is −903.4522. Across repeated bridge calculations, the minimum is −903.4565 and the maximum is −903.4481. The interquartile range is 0.002682305. These figures indicate limited variation from proposal resampling for that fitted posterior sample.

Under equal prior probabilities over the candidate factor structures, the first reported repetition gives:

Exchange-rate analysis, posterior probability in the first repetition The two-factor candidate receives the greatest posterior support.

**The numbers**

| System or setting | Posterior probability |
| --- | --- |
| One factor | 6.278942e-49 |
| Two factors (this paper) | 0.8435919 |
| Three factors | 0.1564081 |

The full set of repetitions also favors the two-factor candidate. Lopes and West, whose interpretation of the loadings distinguished a North American factor from a European Union factor, reported a preference consistent with the paper’s conclusion.

There is nevertheless an important qualification in the comparison with that earlier calculation. Lopes and West reported negative infinite log evidence for the three-factor alternative. The authors suggest that this may reflect a numerical issue. Their finite result leaves the three-factor candidate with some support, instead of assigning all posterior probability to the two-factor choice. The paper thus reproduces the preferred structure while also showing why stable evidence calculations matter for the strength of the conclusion.

### What the ablations show

The paper contains no formal ablation study; it instead offers reference comparisons, a conceptual comparison of proposal strategies, and analyses of estimation uncertainty.

The reference comparisons test whether a general-purpose implementation can recover answers obtained through other calculations. The sleep example checks agreement with the BayesFactor package. The turtle example checks agreement with extensive numerical integration from an earlier study. The exchange-rate analysis checks consistency with earlier bridge-sampling results where finite reference values are available.

These checks support the implementation, but they do not isolate the contribution of every design choice. The paper does not remove the Jacobian adjustment, disable the sample split, or systematically vary numerical safeguards and measure the consequences. Those elements are motivated by the method and cited prior work rather than evaluated through a component-by-component experiment in this article.

#### What the normal and Warp-III comparison explains

The comparison between `normal` and `warp3` identifies a specific source of potential improvement: skewness in the posterior after transformation to an unconstrained space. Both approaches align location and covariance. Warp-III also symmetrizes the target used in the bridge calculation.

This is more informative than saying that a more elaborate method is simply better. It identifies the shape feature that motivates extra computation. If the transformed posterior is already symmetric, the authors expect similar efficiency. If it is skewed, the additional alignment may reduce variability. If it has several separated modes, neither moment matching nor symmetrization necessarily produces sufficient overlap.

The paper does not report a paired benchmark of both options across all demonstrations. The sleep and turtle examples use the normal method, while the factor analysis uses Warp-III. Their different datasets and statistical structures prevent a clean empirical attribution of cross-example differences to the bridge option alone.

The claim about Warp-III’s precision should therefore be read alongside its methodological rationale and cost. The article provides an explanation of why it can help and an example of its use. It does not establish a universal runtime advantage or quantify its gain over the normal option for every posterior shape.

#### What repeated calculations establish

The factor-analysis repetitions are a controlled examination of proposal-sampling variability. The posterior draws remain fixed while the bridge computation generates new proposal samples. This reveals how sensitive the evidence calculation is to that part of the random procedure.

The distinction limits the interpretation of a narrow range. It shows that the bridge result is stable under new proposal draws for the available posterior sample. It does not show that a new posterior run would yield the same answer. Nor does it show that all posterior modes were represented.

The authors explicitly recommend a more demanding analysis when feasible: obtain fresh posterior draws, recompute evidence, and repeat the final comparison. That advice turns uncertainty assessment into a test of the whole computational chain. It is particularly valuable when the quantity reported to readers is a Bayes factor or posterior probability rather than an individual log marginal likelihood.

#### What the examples reveal about complexity

The turtle analysis reports a larger approximate error for the random-effects alternative than for the null. This is a useful within-application comparison because both calculations concern the same observations and a closely related scientific question. It illustrates that adding hierarchical structure can make the evidence calculation more demanding.

The result does not identify a single cause. The alternatives differ in their parameter spaces and posterior geometry, and the article does not separately manipulate those factors. The defensible conclusion is that uncertainty should be measured for each evidence estimate rather than assumed constant across a comparison.

The exchange-rate example adds another lesson. Numerical stability can affect more than the final decimal places of an estimate. A failed evidence calculation for a competing candidate can make the preferred candidate appear more certain than the finite calculations justify. The authors present this as a possible explanation of the earlier infinite result, instead of proving the exact origin of that result.

### Limitations

#### Limits the authors explicitly identify

Representative posterior sampling is a prerequisite. Bridge sampling does not establish that the chains supplied to it have reached the intended joint posterior distribution. The authors require careful inspection of posterior samples and convergence. In the factor-analysis example, they specifically report encountering convergence difficulties and advise checking the chains.

Sampling effort can also be substantial. The paper suggests that comparison may require about an order of magnitude more posterior draws than estimation. This is practical guidance, not a fixed requirement applying identically to every analysis. The needed effort depends on complexity, the sampling procedure, the accuracy desired, and how many draws would otherwise be considered sufficient.

Discrete unknown parameters are unsupported by the implementation described. The authors suggest integrating them out where possible. This restriction concerns unknown quantities in the parameter space, instead of forbidding discrete observations: the turtle demonstration itself uses binary survival outcomes. Whether marginalization is feasible remains application-dependent.

Overlap remains a limiting condition. A fitted Gaussian proposal can approximate location, scale, and correlation without matching a complicated posterior adequately. Warp-III can address skewness but does not guarantee a good representation of several modes. The authors describe more effective treatment of such cases as an ongoing research problem.

Warp-III also increases computational expense. Its mixture construction requires additional density evaluations, making execution about twice as costly in the authors’ description. The potential precision benefit therefore needs to be judged against available resources. A method that reduces variability per estimate may still be unnecessary when the normal approach already meets the application’s precision requirements.

The error diagnostics are not interchangeable. Approximate errors for a single calculation are available for the normal method, while the corresponding Warp-III approximations were judged unreliable. Repetition with fixed posterior draws captures only part of the overall uncertainty. The authors repeatedly emphasize that limitation instead of treating repeated bridge runs as a complete validation.

Prior choice has a lasting effect on the result. Automation of integration does not remove the scientific responsibility to specify meaningful priors. The authors recommend sensitivity analysis or defensible default choices. In the turtle and exchange-rate demonstrations, priors are retained from earlier studies to enable comparison; reproducing those choices is not presented as a general endorsement for unrelated applications.

The authors also identify situations in which a different comparison method may be preferable. For nested alternatives, a Savage–Dickey calculation can be simpler or faster. When the space of candidates is very large, estimating evidence separately for each may be too expensive, making a reversible-jump approach more suitable. The package’s broad interface does not imply that it is always the most efficient choice.

There are implementation-specific qualifications as well. The Windows parallelization described does not support the Stan fit interfaces. The NIMBLE interface had received less intensive testing than the Stan interface at the time of writing. These details qualify the breadth of the software claim without changing the bridge identity itself.

#### Limits visible in the experimental setup

The validation suite is focused. It shows agreement in selected applications with useful reference calculations, instead of mapping failure rates across a broad family of posterior distributions. The article does not systematically vary dimension, tail behavior, skewness, mode separation, or chain quality. Its examples establish feasibility and numerical agreement under their reported conditions.

The paper also does not provide a comprehensive speed comparison against the methods named in its introduction. It explains where computation is spent and why parallel density evaluation can help, but it does not establish that the package outperforms every alternative on matched tasks. Claims of convenience and general applicability have stronger direct support here than claims of universal computational superiority.

A small numerical error does not validate the scientific specification. The turtle result can be estimated precisely while offering only weak discrimination between the hypotheses. Conversely, a highly concentrated posterior probability can still depend strongly on the prior and the candidate set. Numerical reliability, evidential strength, and scientific adequacy are distinct questions.

The retained-constants requirement creates another important boundary. Correct posterior sampling does not prove that the density evaluator is suitable for evidence estimation. Missing normalizers, incorrect truncation adjustments, or inconsistent parameterization can affect the integral even when routine parameter summaries appear reasonable. The Stan interface reduces manual work but depends on the target being coded correctly.

The sleep example deserves particular care because its conceptual discussion uses a Jeffreys variance prior while its displayed evaluator uses a proper gamma distribution on precision. A careful reading should preserve that distinction rather than describe the implemented evidence as if every prior detail were identical to the symbolic presentation. The package estimates the integral of the supplied density.

The exchange-rate repetitions likewise support a conditional conclusion. Their limited spread is evidence of stability under proposal resampling for the fitted posterior draws. It is not a measurement of variability across independently repeated posterior fits. The authors recommend that broader assessment, but the displayed repetition output does not perform it.

Finally, posterior probabilities remain relative to the alternatives included. In the factor analysis, support is distributed across the factor counts under consideration and their specified priors. Preference within that collection does not establish that the selected factor structure is a complete account of exchange-rate behavior. The paper demonstrates a method for comparing explicit statistical candidates; it does not turn that comparison into unrestricted confirmation of their assumptions.

### What came after

The paper’s forward-looking contribution is a plan for making evidence estimation easier to connect to other statistical software. It proposes broader support for packages that already generate posterior samples, with the aim of approaching the convenience achieved through Stan.

For systems that use Stan internally, the authors identify preservation of density constants as the main potential adjustment. Once the fitted object exposes the correct log density and transformations, much of the bridge-sampling workflow can be reused. This is a concrete extension of the paper’s interface design: avoid asking users to reimplement information that the fitting system already possesses.

For software outside that arrangement, the difficult part is automatically recovering the unnormalized posterior evaluator and parameter bounds. The authors mention MCMCglmm, the JAGS connection in mgcv, glmmBUGS, and blavaan as possible targets for future integration. These are proposed directions, not completed follow-up results established by the article.

The methodological agenda also remains open around multimodal distributions. Better overlap is still needed when Gaussian alignment and Warp-III transformations do not adequately represent the target. The article points to ongoing work on warp bridge sampling and related approaches, but those references describe the research context available to its authors rather than a verified sequence of later developments.

No later citing studies are established here. The supported conclusion is therefore about the direction the paper set: reusable evidence estimation built around existing posterior samplers, explicit density bookkeeping, and uncertainty assessment. Its lasting practical lesson is that making an integral easier to compute should leave the assumptions behind that integral easier to examine.

## Cite

Cite as Quentin F. Gronau, Henrik Singmann and Eric‐Jan Wagenmakers. 2020. bridgesampling: An R Package for Estimating Normalizing Constants. Journal of Statistical Software.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18637/jss.v092.i10](https://doi.org/10.18637/jss.v092.i10) · [arXiv 1710.08162](https://arxiv.org/abs/1710.08162)

```bibtex
@article{gronau2020bridgesampling,
  title = {{bridgesampling: An R Package for Estimating Normalizing Constants}},
  author = {Quentin F. Gronau, Henrik Singmann and Eric‐Jan Wagenmakers},
  journal = {Journal of Statistical Software},
  year = {2020},
  doi = {10.18637/jss.v092.i10},
  eprint = {1710.08162},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.18637/jss.v092.i10}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
