Source-linked AI summary
Marginal Likelihoods from Monte Carlo Markov Chains
Alan Heavens, Yabebal Fantaye, Arrykrishna Mootoovaloo, Hans Eggers, Zafiirah Hosenie, Steve Kroon, Elena Sellentin
TL;DR
Marginal likelihoods enable Bayesian model comparison but can be challenging to compute in high-dimensional parameter spaces. This paper estimates them from sampled posterior densities using a Bayesian nearest-neighbor method; for Gaussian targets, it reports percent-level accuracy through 10 dimensions and accuracy within a factor of ~2 at 20 dimensions with chains of length 10^5.
Problem
Marginal likelihoods support Bayesian model comparison but can be challenging to compute from samples in high-dimensional parameter spaces.
Source: §II · p. 3Method
The method estimates the marginal-likelihood posterior from whole-chain kth-nearest-neighbor density estimates using a Mahalanobis metric, and extends to weighted chains.
Source: §II · pp. 4–5, §III · p. 6Results
With Gaussian targets and chains of length 10^5, the method achieves percent-level accuracy up to 10 dimensions and accuracy within a factor of ~2 at 20 dimensions.
Source: §V · p. 12Takeaways & Limitations
Chains sampled for parameter inference can also be used to calculate the model's marginal likelihood.
Source: §II · p. 5The method assumes independent chain points, so typical MCMC chains may require correlation checks and thinning, and can fail when density varies across nearest-neighbor distances.
Source: §V · p. 13
Abstract
from arXiv · showhide
In this paper, we present a method for computing the marginal likelihood, also known as the model likelihood or Bayesian evidence, from Markov Chain Monte Carlo (MCMC), or other sampled posterior distributions. In order to do this, one needs to be able to estimate the density of points in parameter space, and this can be challenging in high numbers of dimensions. Here we present a Bayesian analysis, where we obtain the posterior for the marginal likelihood, using $k$th nearest-neighbour distances in parameter space, using the Mahalanobis distance metric, under the assumption that the points in the chain (thinned if required) are independent. We generalise the algorithm to apply to importance-sampled chains, where each point is assigned a weight. We illustrate this with an idealised posterior of known form with an analytic marginal likelihood, and show that for chains of length $\sim 10^5$ points, the technique is effective for parameter spaces with up to $\sim 20$ dimensions. We also argue that $k=1$ is the optimal choice, and discuss failure modes for the algorithm. In a companion paper (Heavens et al. 2017) we apply the technique to the main MCMC chains from the 2015 Planck analysis of cosmic background radiation data, to infer that quantitatively the simplest 6-parameter flat $\Lambda$CDM standard model of cosmology is preferred over all extensions considered.
II. INTRODUCTION
The introduction motivates reusing MCMC samples to estimate marginal likelihoods, a quantity central to Bayesian model comparison, and proposes a Bayesian nearest-neighbour approach to estimating it.
Motivation
- Marginal likelihoods support Bayesian model comparison, but computing them can require difficult, expensive integrals over high-dimensional parameter spaces.Because MCMC chains already explore parameter spaces for inference, the introduction motivates using their point density to recover the marginal likelihood.Source: §II · pp. 3–4
Contribution
- The proposed Bayesian method uses kth-nearest-neighbour distances with a suitable metric to estimate the unknown density normalisation constant from MCMC samples.Each chain point contributes a likelihood for the constant, allowing the full chain to yield a precise and accurate posterior estimate.Source: §II · p. 4
Related work
- Existing MCMC estimators include the Harmonic mean method, which can have high or infinite variance, and Chib-based methods, which can be precise but require case-specific adaptation.The cited methods include Newton and Raftery, Chib, and Chib and Jeliazkov.Source: §II · pp. 4–5
- Other approaches reviewed include ABC, variational and power-posterior methods, bridge sampling, INLA, and methods designed explicitly to estimate marginal likelihoods.The introduction cites these approaches as Marin et al., Jordan et al., Friel and Pettitt, Meng and Wong, Rue et al., and.Source: §II · p. 5
III. METHOD
The method estimates marginal likelihood from the density of sampled posterior points: determining the proportionality constant linking MCMC number density to the unnormalised posterior yields E. Unlike Chib’s approach of evaluating posterior density at one point, it uses the entire chain.
III. METHOD
- The expected MCMC number density n(θ|x, M) is proportional to the parameter-space target density, here the unnormalised posterior defined as likelihood times a properly normalised prior.Source: §III · p. 6
- Determining the proportionality constant a allows the marginal likelihood E to be obtained from the sampled number density n, a sum of Dirac delta functions.The constant a scales with the total number of samples N.Source: §III · p. 6
- E = N ˜p/n ≡ aN, and the proposed approach uses the entire chain rather than determining a from posterior density at one point.For importance-sampled or weighted chains, the method is modified as discussed in section III B.Source: §III · p. 6
A. Bayesian determination of the marginal likelihood
The section estimates marginal likelihood from nearest-neighbour distances by combining per-point likelihoods in a Bayesian posterior. Its validity depends on sample-independence and local-density assumptions, which can fail as dimension increases.
A. Bayesian determination of the marginal likelihood
- The method assumes independent chain points, potentially requiring thinning, and requires the chain to record the unnormalised target density alongside parameter values.Independence of the kth-neighbour distances is assumed when forming the posterior across the chain.Source: A. Bayesian determination of the… · pp. 6–7
- Nearest-neighbour distances provide per-point likelihoods that combine into a Bayesian posterior for the marginal likelihood; the authors conclude that k = 1 is preferred.The method develops the formalism for general k.Source: A. Bayesian determination of the… · pp. 6–7
- The evidence is parameterised as E = a^N, and a Jeffreys prior proportional to 1/E is used to obtain its posterior.The section also identifies the maximum-posterior evidence and an approximate posterior fractional variance from the peak.Source: A. Bayesian determination of the… · pp. 7–8
- The variance estimate may be low by a factor of about 2 because nearest-neighbour relationships are often mutual, even when a chain is suitably thinned.The independence approximation is expected to be good for a suitably thinned chain, but mutual nearest neighbours can make the variance underestimate.Source: A. Bayesian determination of the… · p. 8
- For fixed chain length, the method is expected to fail at higher dimensionality when typical kth-neighbour distances span regions where the target density is not approximately constant.The local-density assumption is most plausible when sampling density is high enough for density to be treated as uniform over volumes much larger than typical neighbour balls.Source: A. Bayesian determination of the… · pp. 7–8
B. Importance-sampled case
The section extends marginal-likelihood estimation to importance-sampled chains and presents the posterior for the marginal likelihood under this setup.
B. Importance-sampled case
- The method handles chains sampling from q(θ) rather than ˜p by assigning each sample point a weight wα = w(θα).Source: B. Importance-sampled case · p. 8
- The section gives the maximum-posterior value of E and reports that the estimated posterior fractional variance is unchanged.Source: B. Importance-sampled case · p. 9
- Equation (18) is the paper’s principal result: the posterior for the marginal likelihood, or Bayesian evidence, in the importance-sampled case.The posterior is derived assuming a Jeffreys prior and Poisson sampling.Source: B. Importance-sampled case · p. 9
C. Pre-whitening
Pre-whitening makes parameter-space nearest-neighbour distances dimensionless and treats parameters on the same footing by diagonalising and rescaling them to equal variance. This is equivalent to using the Mahalanobis distance and is effective for unimodal likelihoods.
C. Pre-whitening
- Pre-whitening diagonalises parameter space and rescales parameters to equal variance before measuring Euclidean nearest-neighbour distances, equivalent to the Mahalanobis metric in the original space.The method is described as effective for unimodal likelihoods.Source: C. Pre-whitening · p. 9
- The procedure computes the chain covariance matrix, diagonalises it, and rescales the resulting parameter combinations by the square roots of its eigenvalues to obtain identity covariance.Source: C. Pre-whitening · p. 9
IV. RESULTS
The analytic Gaussian benchmark shows that the method performs best with k=1, while pre-whitening improves accuracy and the 20-dimensional estimate is accurate to about a factor of two.
IV. RESULTS
- The benchmark uses independent m-dimensional vectors drawn from a multivariate Gaussian with an analytic solution.The covariance matrix is fixed and arbitrary; the model parameters are the m expectation values.Source: §IV · pp. 9–10
- In 20 dimensions, the evidence accuracy is about a factor of two with 10^5 MCMC points, a level the authors consider potentially useful for model comparison.The authors note that evidence calculations have some prior sensitivity.Source: §IV · p. 10
- Without pre-whitening, the 5-dimensional comparison favors MAP with k=1, though none of its results are very accurate; with pre-whitening, 10-dimensional results favor k=1 over k=4 and are much more accurate.For 8 dimensions, MAP estimates with k=1 are shown with and without pre-whitening; the passage does not state that these results are inaccurate.Source: §IV · p. 10
V. DISCUSSION
The discussion presents k-nearest-neighbour density estimates as a Bayesian route to marginal likelihoods from sampled chains, with Mahalanobis geometry enabling high-dimensional accuracy and caveats around dependence and target structure.
V. DISCUSSION
- Although k = 1 is noisier than k = 4, it is more accurate and optimal because inaccuracies increase with k.The comparison is shown for a pre-whitened, 10-dimensional case.Source: §V · pp. 12–13, Figure 3 · p. 12
- Nearest-neighbour distances encode the unknown density normalization, allowing a Bayesian posterior for marginal likelihoods from sampled chains; the method also handles importance-sampled chains.The posterior information from individual points can be combined across a typical chain; the authors note that the method is convenient for Bayesian density analysis.Source: §V · pp. 10, 12
- With chains of length 105, Mahalanobis distance gives percent-level accuracy through 10 dimensions and factor-∼2 accuracy at 20, while naive Euclidean distance fails beyond a few.Pre-whitening is equivalent to using the Mahalanobis distance, provided the Jacobian is accounted for.Source: §V · p. 12
- The method assumes independent points and can fail when target density varies across nearest-neighbour scales or has fine structure, especially in high dimensions or with small samples.Correlation analysis and thinning may be needed. Significant errors of 0.1 dex occur when (α_mN/V)^(-1/m) > 0.5; a local Mahalanobis metric or expected curvature matrix may help with complex targets.Source: §V · p. 13