Bayes' theorem can be applied to a pair of competing models
and
for data
, one of which must be true (though which one is not known) but which both
cannot simultaneously be true, as follows:
Given no a priori information in favor of
or
, it is reasonable to assign prior probabilities
, so that
. The remaining ratio
is not so easy to evaluate since in general it requires marginalization of
nuisance parameters. Generally,
has a collection of parameters that can be
lumped together and called
, and
has its own vector of parameters
that may be of different dimensionality but is still referred to as
.
The marginalization for
is
and likewise for
. This integral is often analytically intractible, and in
these cases it is necessary to employ a numerical algorithm to find an approximation. The
Nested Sampling algorithm was developed by John Skilling specifically to approximate these
marginalization integrals, and it has the added benefit of generating samples
from the posterior distribution
[1].
Here is a simple version of the Nested Sampling algorithm, followed by a
description of how it computes the marginal probability density
where
is
or
:
Start with
points
sampled from prior.
for
to
do % The number of iterations j is chosen by guesswork.
current likelihood values of the points
;
Save the point with least likelihood as a sample point with weight wi.
Update the point with least likelihood with some Markov Chain
Monte Carlo steps according to the prior, accepting only steps that
keep the likelihood above
.
end
return
;
At each iteration,
is an estimate of the amount of prior mass covered by
the hypervolume in parameter space of all points with likelihood greater than
. The weight factor
is
an estimate of the amount of prior mass that lies between two nested
hypersurfaces
and
. The update step
computes the sum over
of
to numerically approximate the integral
The idea is to chop up the range of
and estimate,
for each interval
, how likely it is a-priori
that a randomly chosen
would map to this interval. This can be
thought of as a Bayesian's way to numerically implement Lebesgue integration.
References
[1] Nested Sampling for General Bayesian Computation. John Skilling.
2006. International Society for Bayesian Analysis.