Nested sampling for physical scientists

G. Ashton, Noam Bernstein, Johannes Büchner, Xi Chen, Gábor Cśanyi, Andrew Fowlie, Farhan Feroz, Matthew Griffiths, Will Handley, Michael Habeck, Edward Higson, M. P. Hobson, A. Lasenby, David Parkinson, Lívia B. Pártay, M. Pitkin, Doris Schneider, Joshua S. Speagle, Leah F. South, J. Veitch, Philipp Wacker, David J. Wales, D. P. YallupNature Reviews Methods Primers 2022 · DOI

Abstract

Nested Sampling (NS) is a robust algorithm for Bayesian inference that simultaneously performs parameter estimation and calculates the marginal likelihood, or "evidence." By iteratively compressing an ensemble of "live points" toward regions of higher likelihood, NS transforms complex, high-dimensional integrals into a manageable one-dimensional problem. This paper reviews the fundamental mechanics of the algorithm, its advantages over traditional Markov Chain Monte Carlo (MCMC) methods—particularly in handling multi-modality and high dimensionality—and its successful application across fields such as cosmology, gravitational wave astronomy, and materials science.

Introduction

In Bayesian inference, researchers seek to characterize the posterior distribution of model parameters and calculate the evidence (marginal likelihood) for model comparison. While Markov Chain Monte Carlo (MCMC) methods are standard for mapping posterior shapes, they often struggle with calculating evidence and can become trapped in local maxima in multi-modal distributions. Furthermore, as the number of dimensions ($D$) increases, the exponential growth of parameter space—the "curse of dimensionality"—renders grid-based integration impossible. Nested Sampling, introduced by John Skilling in 2004, was designed to address these specific challenges, providing a robust framework for both evidence calculation and posterior sampling.

Methodology: The 1D Transformation

The defining feature of Nested Sampling is the transformation of a multi-dimensional integral into a one-dimensional integral over the "prior volume" ($X$). The prior volume $X(\lambda)$ represents the fraction of the prior space where the likelihood $L(\theta)$ exceeds a threshold $\lambda$.

The algorithm maintains a set of "live points" initially drawn from the prior. The process proceeds iteratively:

  1. Identify the point with the lowest likelihood ($L^*$).
  2. Remove this "worst" point and record it as a "dead point."
  3. Draw a replacement point from the prior, subject to the constraint that its likelihood must be greater than $L^*$.
Iterative steps of the Nested Sampling algorithm: live points are compressed toward higher likelihood regions.

This iterative process effectively "shrinks" the volume of the parameter space being explored. Each removed point provides a sample of the likelihood at a specific prior volume, allowing the total evidence $Z$ to be estimated as a summation: $Z \approx \sum L_i \Delta X_i$.

Accumulation of Bayesian evidence Z as a one-dimensional integral over prior volume X.

Sampling Strategies

A critical challenge in NS is drawing a new point that satisfies the likelihood constraint. Two main strategies are employed:

  • Region Samplers: These methods bound the current live points within geometric shapes (e.g., ellipsoids). While efficient for low-dimensional problems ($D < 20$), they become less effective as dimensionality increases.
  • Step Samplers: These utilize MCMC-like random walks or slice sampling to evolve an existing live point to a new location. These methods scale polynomially ($O(D^2)$), making them suitable for problems with hundreds of dimensions.

Applications in the Physical Sciences

Nested Sampling has become a cornerstone tool in several high-stakes research domains:

  • Cosmology: NS is used to analyze Cosmic Microwave Background (CMB) data from the Planck mission and Type Ia supernovae. It enables robust model selection, such as determining whether data favors a flat or curved universe.
  • Gravitational Waves: In analyzing signals from LIGO/Virgo, NS helps estimate the masses and spins of colliding black holes by navigating the complex, multi-modal parameter spaces of these events.
  • Materials Science: The algorithm is used to simulate atomic clusters (e.g., Lennard-Jones clusters) to identify phase transitions and visualize energy landscapes, which is crucial for understanding molecular-level melting and freezing.

Key Insights and Results

Nested Sampling offers several advantages over traditional methods:

  • Simultaneous Output: It provides both the evidence and the posterior samples in a single run, facilitating immediate model comparison.
  • Robustness to Multi-modality: By mapping the landscape onto a 1D line, NS can handle "banana-shaped" or multi-peak distributions that often cause MCMC to fail.
  • Self-Tuning: Unlike MCMC, which requires manual tuning of step sizes, the ensemble of live points in NS naturally defines the scale of the search.
  • Dimensional Scaling: Step-sampling variants of NS effectively bypass the exponential curse of dimensionality, showing polynomial run-time scaling.

Limitations and Future Directions

Despite its power, NS has limitations. It requires a "proper" (normalizable) prior, making it difficult to use with the uninformative infinite priors sometimes favored in other Bayesian contexts. Additionally, the algorithm can struggle with "likelihood plateaus" where the lack of gradient makes volume compression difficult to track. For extremely high dimensions ($D > 500$), memory constraints for storing dead points can also become an issue.

Future work focuses on integrating Machine Learning techniques, such as normalizing flows, to help the algorithm learn the shape of the constrained prior more efficiently. This synergy aims to push Nested Sampling into even higher-dimensional regimes, further expanding its utility in complex physical simulations.

Summary updated

BibTeX
@article{ashton2022nested,
  author = {G. Ashton and Noam Bernstein and Johannes Büchner and Xi Chen and Gábor Cśanyi and Andrew Fowlie and Farhan Feroz and Matthew Griffiths and Will Handley and Michael Habeck and Edward Higson and M. P. Hobson and A. Lasenby and David Parkinson and Lívia B. Pártay and M. Pitkin and Doris Schneider and Joshua S. Speagle and Leah F. South and J. Veitch and Philipp Wacker and David J. Wales and D. P. Yallup},
  title = {{Nested sampling for physical scientists}},
  journal = {Nature Reviews Methods Primers},
  year = {2022},
  doi = {10.1038/s43586-022-00121-x},
}
Figure