Algorithmadvanced
Nested sampling
Also called Skilling's nested sampling.
Skilling's estimator of the marginal likelihood that replaces the worst of a set of live points by a new prior draw of higher likelihood and integrates over the shrinking prior mass.
- Time
- Θ(N (H + K) C) expected
- Space
- Θ(N (H + K)) extra
- Where
- C = the cost of one constrained prior draw; H = the information, KL(posterior || prior), in nats; K = log(1/eps) for the stopping tolerance eps; N = the number of live points
- Model
- Real RAM
- Properties
- randomizednot exactofflineiterative
- Evidence
- Proof sketchCode in 1 languages
- Origin
- John Skilling, 2006
Nested sampling estimates the marginal likelihood , where is the likelihood and the prior. It rewrites as a one-dimensional integral over the prior mass that lies above a given likelihood level. It keeps live points drawn from the prior. At each step it removes the live point with the lowest likelihood, which shrinks the prior mass above it by a random factor with known law, , and replaces the point by a prior draw constrained to higher likelihood. The removed points, with weights, give and a weighted posterior sample. The error of is about , where is the information gained from prior to posterior.
In plain words
Picture the likelihood as a landscape of hills and the prior as a layer of sand over it. To find the total "weight" of the landscape, you can slice it into horizontal layers and add up height times the area of sand above each height. Nested sampling makes these slices from the bottom up. It keeps a fixed number of sample points spread over the sand. At each step it throws away the lowest point, and that point's height becomes the next slice. On average, each step removes the same small fraction of the remaining sand, so the area above each slice is known without measuring it. A new point is then placed at random anywhere higher than the one thrown away. The run stops when the points left can add almost nothing. The cost is to find random points above a given height.
The problem
Input. A proper prior from which we can draw, a likelihood that we can evaluate, a number of live points, and a stopping tolerance . A routine that draws from restricted to for any level .
Output. An estimate of , an estimate of its error, and weighted posterior draws.
The prior mass. For a level , let be the prior mass above it. decreases from to as grows. Its inverse is a non-increasing function on , and the layer-cake identity
turns an integral over , of any dimension, into an integral of a monotone function of one variable. The difficulty is that cannot be computed. Nested sampling estimates it from the order of the likelihood values.
The algorithm
NESTED-SAMPLING(π, L, N, ε)- 1
draw θ₁..θ_N from π ▷ the live points - 2
Z ← 0; X₀ ← 1; i ← 0 - 3
repeat - 4
i ← i + 1; k ← argmin_j L(θ_j); Lᵢ* ← L(θ_k) ▷ the dead point - 5
Xᵢ ← exp(-i/N) ▷ estimated prior mass above Lᵢ* - 6
wᵢ ← X_{i-1} - Xᵢ; Z ← Z + Lᵢ* wᵢ - 7
θ_k ← a draw from π restricted to {θ : L(θ) > Lᵢ*} - 8
until max_j L(θ_j) · Xᵢ < ε Z - 9
Z ← Z + (Xᵢ/N) Σ_j L(θ_j) ▷ the live points share the rest - 10
return Z, the dead points with weights Lᵢ* wᵢ / Z, and the live points with weights L(θ_j) Xᵢ / (N Z)
L1 starts with independent prior draws. At every step, the live points are independent draws from the prior above the current level, so their prior masses are independent uniform values below the current mass . L4 picks the lowest likelihood, which is the point with the largest prior mass. Its mass is the largest of uniform values on , so the ratio has the law , whatever the model is. Since , L5 sets to its mean . L6 adds the slab between and at height . L7 is the only model-specific step: it must give an independent draw from the prior above the new level. L8 stops when even the best live point, times the remaining mass, would change by less than a fraction . L9 adds the remaining mass, shared equally among the live points.
The implementation works with , and , and adds terms with log-sum-exp, because is often . It keeps the live points in a heap keyed by . It also computes the information
the Kullback-Leibler divergence from the prior to the posterior, and reports as the error of .
Constrained draws. In the tests, is an interval, so L7 draws from the prior restricted to it exactly by the inverse distribution function. In real problems, L7 is approximate: a short Markov chain started from a random live point (slice sampling or random walk Metropolis-Hastings that rejects moves below ), or a draw from ellipsoids that bound the live points.
Example
Trace. successes in Bernoulli trials, , uniform prior on . The exact value is , ; the posterior is Beta(4, 8) and . Run with , and random.Random(4). The column "true " is the length of the interval , which the method does not know.
| dead point | true | so far | ||||
|---|---|---|---|---|---|---|
| 1 | 0.1032 | 0.06149 | 0.7788 | 0.4652 | 0.2212 | 0.01360 |
| 2 | 0.1341 | 0.10563 | 0.6065 | 0.3785 | 0.1723 | 0.03180 |
| 3 | 0.1550 | 0.13742 | 0.4724 | 0.3240 | 0.1342 | 0.05023 |
| 4 | 0.4524 | 0.16404 | 0.3679 | 0.2797 | 0.1045 | 0.06737 |
| 5 | 0.3966 | 0.21800 | 0.2865 | 0.1826 | 0.0814 | 0.08511 |
| 6 | 0.3961 | 0.21849 | 0.2231 | 0.1816 | 0.0634 | 0.09896 |
| 7 | 0.2360 | 0.23969 | 0.1738 | 0.1336 | 0.0494 | 0.11079 |
| 8 | 0.3537 | 0.25009 | 0.1353 | 0.1040 | 0.0384 | 0.12040 |
The dead points move in from both sides towards the mode , and their likelihoods increase. In this run the first dead point was low by chance: the true mass is far below the estimate , because the largest of uniform values happened to be small. That error stays in every later . The test of L8 stops after dead points, and L9 adds the live points. The result is , an error of , with the reported error bar . With the error bar is unreliable too, since it uses the estimated in place of .
The error is about . Same model, : over runs with the standard deviation of is , against . Over runs with it is , against .
Normal-normal. , prior , data from random.Random(1), exact and from the closed form in the proof. With and exact constrained draws:
| runs | mean error | standard deviation | iterations | ||
|---|---|---|---|---|---|
| 25 | 200 | 0.054 | 0.391 | 0.364 | 451 |
| 100 | 200 | 0.184 | 0.182 | 1802 | |
| 400 | 50 | 0.094 | 0.091 | 7200 |
The standard deviation halves when is multiplied by , and stays within percent of . The number of iterations is about , a little more because the test of L8 uses the estimated .
Correctness
The full proof is in proofs/correctness.md. It proves:
- The layer-cake identity with non-increasing, for every prior and likelihood.
- Uniform prior masses. If the law of under the prior has no atoms, the prior mass of a prior draw is uniform on , and that of a draw constrained to is uniform on .
- The shrinkage law. With exact, independent constrained draws, the ratios of the true masses are independent . So is exponential with rate , and . The key invariant is: after each step, the live points are independent prior draws above the current level.
- The estimate. With the true masses, the sum of L6 is an upper Riemann sum of for a monotone function, and the live-point term estimates the rest. L5 uses the geometric mean of .
- The information of the normal-normal model in closed form.
What is proved and what is only measured: items 1 to 3 and 5 are exact. The error size is a heuristic of Skilling (2006): the posterior mass sits near , reached after about steps, where has standard deviation . Chopin and Robert (2010) prove consistency and an error of order with exact constrained draws; this page cites that result and does not prove it. The agreement of the measured standard deviations with in the tables is measured only. With approximate constrained draws, none of the guarantees hold.
Proof: The layer-cake identity and the shrinkage law of nested samplingfull
Setting. is a prior probability measure on a parameter space , and is the likelihood, with . For let
the prior mass above the level . is non-increasing, , and is right-continuous, because when . For define the generalized inverse
Claim 1: the layer-cake identity
, and is non-increasing.
Proof. First, , so Tonelli's theorem gives .
Second, for and ,
If , there is with , and because is non-increasing. If , right-continuity gives with , so . By (1) and Tonelli's theorem on ,
where the last step uses . Finally, if then every with also has , so .
The identity holds for every prior and likelihood, with or without atoms, in any dimension: the integral over becomes an integral of a monotone function on .
Claim 2: the prior mass of a prior draw is uniform
Assume that the law of under has no atoms. Let and . Then . Moreover, for every with , if is drawn from restricted to , then .
Proof. Let be the distribution function of ; it is continuous, and . For the set is non-empty (intermediate value theorem, as goes from to ), closed and bounded above; let be its largest element. If then . If then and , so . Hence , so and are uniform on .
For the second part, and differ by a null set. If then . If then , with equality only when . Let be the largest with ; then , which has probability . So, conditional on , is a uniform variable conditioned to lie below , which is .
Claim 3: the shrinkage law
Under the assumption of Claim 2, and with exact and independent constrained draws on line L7, let be the true prior mass above the -th dead point. Then () are independent with , that is on . Consequently
Proof. Map each live point to its prior mass . Because is non-increasing and, by Claim 2, the values are almost surely distinct, the live point with the lowest likelihood is the one with the largest .
Induction hypothesis : after iterations, given , the live values are independent and . holds by Claim 2 with .
Assume . The dead point of iteration has of independent values, so , and independently of the past. Given the maximum , the joint density of the other values is , so they are independent . The new point of line L7 has , so by Claim 2 its value is , independent of the others because the draw is independent. This is .
For the moments, , so is exponential with rate : mean and variance . Sums of independent terms give the last two formulas.
Claim 4: what the estimate computes
Let be the number of dead points. The estimate is
(a) With the true masses in place of , the sum is an upper Riemann sum of . Indeed almost surely, and for by Claim 1. Since is monotone, the gap between the upper sum and the integral is at most . The rest, , lies between and ; the stopping rule of line L8 asks that , and the live-point term of line L9 is a Monte Carlo estimate of that rest, since the live values are uniform on by Claim 3.
(b) The plug-in. By Claim 3, , the geometric mean of . The error has mean and standard deviation .
(c) The information. Let be the Kullback-Leibler divergence from the prior to the posterior. The posterior mass sits where , so it is reached after about iterations. There, by (b), the error of is about , which is the error estimate of (Skilling 2006).
Part (a) and the moments in (b) are exact. The step from (b) to the size of the error of in (c) is a heuristic: it treats the posterior mass as sitting at one value of . Chopin and Robert (2010) prove that, with exact constrained draws, the estimate is consistent and its error is of order . On the page, the ratio of the measured standard deviation to is measured, not proved.
Claim 5: the exact information of the normal-normal model
For and the posterior is with and , and
Proof. , using and .
Complexity
The run ends when is near , after about iterations with . Each iteration makes one constrained draw of cost and one heap update of cost ; the test of L8 costs , and the code runs it once every iterations. The expected time is . Since the error is about , halving the error costs four times the work. grows with the dimension , roughly like for data points in a regular model, and the cost of a constrained draw also grows with . The dead points take space.
Properties
- Randomized and not exact. has a random error of size about , and has a small bias in finite runs.
- One run gives three results: , an error estimate, and a weighted posterior sample.
- No tuning of a temperature schedule. The level of L4 sets its own schedule, which adapts to the likelihood.
- Handles phase transitions. Methods that follow a path of tempered posteriors can jump across a region where the energy changes suddenly; nested sampling moves in prior mass and does not.
- Needs a proper prior from which one can draw, and works best when the posterior is not far smaller than the prior, since the work grows with .
Variants and improvements
- Ellipsoidal and multi-ellipsoidal sampling. Mukherjee, Parkinson and Liddle (2006) draw L7 from an ellipsoid around the live points; MultiNest (Feroz, Hobson and Bridges, 2009) uses several ellipsoids for multimodal posteriors.
- Slice sampling in L7. PolyChord (Handley, Hobson and Lasenby, 2015) replaces L7 by a short slice sampling chain, which scales to more dimensions than ellipsoids.
- Dynamic nested sampling. Higson and coauthors (2019) change during the run, with more live points where the posterior mass is.
- Several dead points per step. Removing the worst points at once lets constrained draws run in parallel; then shrinks by order statistics of uniform values.
- Random . Replace the plug-in of L5 by draws of , repeat the sum many times, and read the error bar from the spread of .
When to use it
Use nested sampling when you need the marginal likelihood and also posterior draws, the posterior may be multimodal, and the dimension is small or moderate. It is a standard choice for Bayes factors in cosmology and astrophysics. If you already have posterior draws and a proposal that covers them, bridge sampling is more accurate for the same work. The Laplace approximation is far cheaper when the posterior is close to normal. Annealed importance sampling and sequential Monte Carlo are alternatives that follow a path of tempered densities.
Pitfalls
- Correlated constrained draws. If L7 runs a Markov chain from a live point for only a few steps, the new point is not an independent draw above , the law fails, and is biased. Run the chain in L7 long enough to forget its start, and check the result by repeated runs or by comparing with a smaller and a larger .
- Likelihood plateaus. If is constant on a region of positive prior mass, the uniform law of Claim 2 fails, and L4 has ties. L5 then assigns wrong masses. Break the ties in L4 by a tiny random extra coordinate, or treat the plateau mass separately.
- Linear-scale arithmetic. Computing L6 as written underflows when , and the sum is . Keep , and , and add with log-sum-exp.
- Dropping the live points. Stopping at L8 and returning without L9 loses the part of under the live points. At the stop of L8 it is below , but with a loose or a run cut short by an iteration limit it can be most of . Keep L9.
- Dead points as an equal-weight sample. The dead points are spread over the prior, not the posterior. Weighting them equally in L10 gives a sample from the wrong law. Use the weights , or resample with them.
- Too few live points for many modes. With small , a mode of small prior mass can lose all its live points early and is never found again. Increase until the estimate is stable.
Implementations
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/nested-sampling/. The authors are listed in prov/G4YCZZ.jsonl.
"""Nested sampling (Skilling 2006) for the marginal likelihood Z = integral of L(theta) pi(d theta).
The caller gives:
log_lik(theta) the log-likelihood log L(theta);
prior_draw(rng) one draw from the prior pi;
constrained_draw(rng, log_l_star) one draw from pi restricted to {log L > log_l_star}.
The prior mass above the i-th dead likelihood is estimated by X_i = exp(-i/N), because
log X_i is a sum of i independent terms log t with t ~ Beta(N, 1) and E log t = -1/N.
Cost: about N (H + log(1/eps)) iterations for N live points, information H (nats) and
stopping tolerance eps. Each iteration makes one constrained draw and one O(log N)
heap update; the stopping test costs O(N) once every N iterations.
"""
import heapq
import math
import random
from fractions import Fraction
from typing import Callable, Sequence
def _log_add(a: float, b: float) -> float:
"""log(e^a + e^b)."""
if a == -math.inf:
return b
if b == -math.inf:
return a
if a < b:
a, b = b, a
return a + math.log1p(math.exp(b - a))
def _update_h(h_acc: float, log_z_old: float, log_z_new: float, log_term: float, log_l: float) -> float:
"""Running value of (1/Z) sum_i w_i L_i log L_i, rescaled each time Z grows."""
if log_z_old == -math.inf:
return log_l
return math.exp(log_z_old - log_z_new) * h_acc + math.exp(log_term - log_z_new) * log_l
def nested_sampling(
log_lik: Callable,
prior_draw: Callable,
constrained_draw: Callable,
n_live: int,
rng: random.Random,
eps: float = 1e-8,
max_iter: int = 10**7,
) -> dict:
"""Run nested sampling. Returns a dict with
log_z the estimate of log Z,
h the estimated information H = KL(posterior || prior) in nats,
error Skilling's error estimate sqrt(h / n_live) for log_z,
iterations the number of dead points before the live points are added,
dead a list of (theta, log L, log w) for posterior summaries.
Precondition: n_live >= 1; the law of L(theta) under the prior has no atoms;
constrained_draw returns exact, independent draws from the constrained prior.
"""
live = []
for k in range(n_live): # @line L1
th = prior_draw(rng)
live.append((log_lik(th), k, th))
heapq.heapify(live) # live[0] is the live point with the lowest likelihood
counter = n_live
log_z, log_x_prev, i = -math.inf, 0.0, 0 # @line L2
h_acc = 0.0
dead = []
while i < max_iter: # @line L3
i += 1
log_l_star, _, th_star = live[0] # @line L4
log_x = -i / n_live # @line L5
log_w = log_x_prev + math.log(-math.expm1(log_x - log_x_prev)) # log(X_{i-1} - X_i)
log_z_new = _log_add(log_z, log_l_star + log_w) # @line L6
h_acc = _update_h(h_acc, log_z, log_z_new, log_l_star + log_w, log_l_star)
log_z = log_z_new
dead.append((th_star, log_l_star, log_w))
th_new = constrained_draw(rng, log_l_star) # @line L7
heapq.heapreplace(live, (log_lik(th_new), counter, th_new))
counter += 1
log_x_prev = log_x
if i % n_live == 0:
log_l_max = max(p[0] for p in live)
if log_l_max + log_x < math.log(eps) + log_z: # @line L8
break
log_w = log_x_prev - math.log(n_live)
for log_l, _, th in live:
log_z_new = _log_add(log_z, log_l + log_w) # @line L9
h_acc = _update_h(h_acc, log_z, log_z_new, log_l + log_w, log_l)
log_z = log_z_new
dead.append((th, log_l, log_w))
h = h_acc - log_z
return { # @line L10
"log_z": log_z,
"h": h,
"error": math.sqrt(max(h, 0.0) / n_live),
"iterations": i,
"dead": dead,
}
def posterior_mean(result: dict, f: Callable) -> float:
"""Posterior mean of f(theta) from the dead points, with weights w_i L_i / Z."""
log_z = result["log_z"]
return math.fsum(math.exp(lw + ll - log_z) * f(th) for th, ll, lw in result["dead"])
def layer_cake(values: Sequence, probs: Sequence) -> Fraction:
"""Z = integral_0^1 L(X) dX for a discrete prior, as an exact sum over the levels of L.
X(lam) = P(L > lam) is a step function; sorting the distinct values of L in
decreasing order and adding L_k (X(L_k-) - X(L_k)) gives sum_k p_k L_k exactly.
Inputs are Fractions (or ints); ties in L are allowed.
"""
levels = sorted(set(values), reverse=True)
total = Fraction(0)
for lam in levels:
above = sum((p for v, p in zip(values, probs) if v > lam), Fraction(0)) # X(lam)
at_or_above = sum((p for v, p in zip(values, probs) if v >= lam), Fraction(0))
total += Fraction(lam) * (at_or_above - above)
return total
test_nested_sampling.py 144 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/nested-sampling/. The authors are listed in prov/G4YCZZ.jsonl.
"""Tests for nested sampling: the layer-cake identity, the shrinkage law, and log Z of conjugate models.
All constrained draws are exact: the set {L > L*} is an interval in these models, so a
draw from the prior restricted to it comes from the inverse CDF.
"""
import math
import random
import statistics
import unittest
from fractions import Fraction as F
from nested_sampling import layer_cake, nested_sampling, posterior_mean
ND = statistics.NormalDist()
def normal_model(xs, sigma, tau):
"""x_j ~ N(theta, sigma^2), theta ~ N(0, tau^2). Returns the model and exact log Z, H, mean."""
n = len(xs)
xb = sum(xs) / n
s2 = sum((x - xb) ** 2 for x in xs)
c = -0.5 * n * math.log(2 * math.pi * sigma**2) - 0.5 * s2 / sigma**2
def log_lik(t):
return c - 0.5 * n * (t - xb) ** 2 / sigma**2
def prior_draw(rng):
return rng.gauss(0.0, tau)
def constrained_draw(rng, log_l_star):
r = math.sqrt(max((c - log_l_star) * 2 * sigma**2 / n, 0.0))
lo, hi = ND.cdf((xb - r) / tau), ND.cdf((xb + r) / tau)
u = lo + (hi - lo) * rng.random()
return tau * ND.inv_cdf(min(max(u, 1e-300), 1 - 1e-16))
v = 1 / (n / sigma**2 + 1 / tau**2)
m = v * n * xb / sigma**2
log_z = c + 0.5 * math.log(v / tau**2) - 0.5 * xb**2 / (tau**2 + sigma**2 / n)
h = 0.5 * math.log(tau**2 / v) - 0.5 + 0.5 * (v + m * m) / tau**2
return log_lik, prior_draw, constrained_draw, log_z, h, m
def binomial_model(n, x):
"""x successes in n trials, uniform prior on p. Exact Z = 1/(n+1)."""
log_c = math.lgamma(n + 1) - math.lgamma(x + 1) - math.lgamma(n - x + 1)
mode = x / n
def log_lik(p):
if p <= 0.0 or p >= 1.0:
return -math.inf
return log_c + x * math.log(p) + (n - x) * math.log1p(-p)
def prior_draw(rng):
return rng.random()
def edge(lo, hi, log_l_star, rising):
for _ in range(60):
mid = 0.5 * (lo + hi)
if (log_lik(mid) > log_l_star) == rising:
hi = mid
else:
lo = mid
return 0.5 * (lo + hi)
def constrained_draw(rng, log_l_star):
a = edge(0.0, mode, log_l_star, True)
b = edge(mode, 1.0, log_l_star, False)
return a + (b - a) * rng.random()
return log_lik, prior_draw, constrained_draw, -math.log(n + 1)
class TestIdentities(unittest.TestCase):
def test_layer_cake_is_exact_on_discrete_priors(self):
rng = random.Random(1)
for _ in range(500):
m = rng.randint(1, 8)
vals = [F(rng.randint(0, 6), rng.randint(1, 4)) for _ in range(m)] # ties happen
w = [rng.randint(1, 9) for _ in range(m)]
probs = [F(k, sum(w)) for k in w]
self.assertEqual(layer_cake(vals, probs), sum(p * v for p, v in zip(probs, vals)))
def test_shrinkage_law_beta_n_1(self):
# L(theta) = theta on a uniform prior, so X(lambda) = 1 - lambda exactly and the
# true prior mass X_i above the i-th dead point is known. Theory: log X_i is a sum of
# i iid log t, t ~ Beta(N, 1): mean -i/N, variance i/N^2; E t = N/(N+1).
rng = random.Random(2)
n_live, steps, reps = 10, 30, 2000
logs, ratios = [], []
for _ in range(reps):
res = nested_sampling(
math.log,
lambda r: 1.0 - r.random(),
lambda r, ls: 1.0 - (1.0 - math.exp(ls)) * r.random(),
n_live, rng, max_iter=steps,
)
xs = [1.0 - th for th, _, _ in res["dead"][:steps]]
logs.append(math.log(xs[-1]))
ratios.append(xs[1] / xs[0])
se = math.sqrt(steps / n_live**2 / reps)
self.assertLess(abs(statistics.mean(logs) + steps / n_live), 4 * se)
self.assertLess(abs(statistics.variance(logs) / (steps / n_live**2) - 1), 0.12)
self.assertLess(abs(statistics.mean(ratios) - n_live / (n_live + 1)), 4 * math.sqrt(0.0069 / reps))
class TestConjugateModels(unittest.TestCase):
def test_normal_normal_log_z_and_error_bar(self):
rng = random.Random(1)
xs = [round(rng.gauss(1.0, 1.0), 2) for _ in range(20)]
log_lik, prior_draw, cdraw, exact, h, m = normal_model(xs, 1.0, 10.0)
self.assertAlmostEqual(exact, -31.327583, places=5)
self.assertAlmostEqual(h, 3.306072, places=5)
n_live, reps = 100, 60
errs, hs, inside = [], [], 0
for _ in range(reps):
res = nested_sampling(log_lik, prior_draw, cdraw, n_live, rng, eps=1e-6)
e = res["log_z"] - exact
errs.append(e)
hs.append(res["h"])
inside += abs(e) <= 2 * res["error"]
self.assertLess(abs(posterior_mean(res, lambda t: t) - m), 0.05)
self.assertLess(abs(statistics.mean(hs) - h), 0.1)
sd = statistics.stdev(errs)
self.assertLess(abs(statistics.mean(errs)), 4 * sd / math.sqrt(reps))
self.assertTrue(0.7 < sd / math.sqrt(h / n_live) < 1.4)
self.assertGreaterEqual(inside, int(0.85 * reps))
def test_beta_binomial_uniform_prior(self):
rng = random.Random(3)
log_lik, prior_draw, cdraw, exact = binomial_model(10, 3)
errs = []
for _ in range(20):
res = nested_sampling(log_lik, prior_draw, cdraw, 50, rng, eps=1e-6)
errs.append(res["log_z"] - exact)
self.assertLess(abs(res["log_z"] - exact), 4 * res["error"])
self.assertLess(abs(posterior_mean(res, lambda p: p) - 4 / 12), 0.03)
self.assertLess(abs(statistics.mean(errs)), 0.1)
if __name__ == "__main__":
unittest.main()
History
John Skilling presented nested sampling in 2004 and gave the full account in Bayesian Analysis in 2006. He took the idea of sorting the prior by likelihood from statistical physics, where the density of states plays the same role as . Mukherjee, Parkinson and Liddle (2006) applied it to cosmological model selection with ellipsoidal sampling. Chopin and Robert (2010) gave the first formal analysis, with consistency and the rate of the error. MultiNest (2009) and PolyChord (2015) made the method practical for multimodal and higher-dimensional problems, and dynamic nested sampling (2019) changes the number of live points during the run.
References
- John Skilling, Nested sampling for general Bayesian computation, Bayesian Analysis 1(4), 2006, pages 833 to 859: the transformation of Z into a one-dimensional integral over the prior mass X, the shrinkage of X by Beta(N, 1) factors, the information H and the error estimate sqrt(H/N), and the termination rule (general locator)
- Nicolas Chopin and Christian P. Robert, Properties of nested sampling, Biometrika 97(3), 2010, pages 741 to 755: consistency of the estimate and the order N^(-1/2) of its error under exact constrained draws (general locator)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag G4YCZZ Edit this page History Report an error Markdown