Adaptive rejection sampling Created 2026-10-05 Updated 2026-10-06
Adaptive rejection sampling builds a piecewise linear upper envelope for a differentiable log-concave probability density, samples from its piecewise exponential form, and accepts with the target-to-envelope ratio. Adding evaluated points improves the envelope without changing the target distribution. Initial tangent slopes must yield integrable tails. The accepted draws are exact samples, unlike a finite run of Markov chain Monte Carlo.
Past exam of the mathematics course of the University of Cambridge 2017 iii Paper 216 1 b Solution Created 2026-10-03 Updated 2026-10-06
Adaptive rejection sampling is exact rejection sampling for a differentiable log-concave probability density. Given interior evaluation points , construct the upper envelopewhere is the unnormalized target probability density function. The concave function lies below all its tangent lines, so . Interpolation between adjacent evaluation points gives a lower envelope there, allowing a squeeze test. The normalized upper envelope is a piecewise exponential proposal distribution.
Draw and an independent from the uniform distribution, and accept when . A squeeze test can establish acceptance without evaluating . Otherwise evaluate and, whenever it is evaluated, add to the envelope's points. Repeat until acceptance. On each linear piece , its integral is on , with value when . These integrals select a piece; inverse transform sampling samples within it.
Here, with and , the log-posterior on hasChoose evaluation points strictly inside , avoiding any endpoint singularities of the logarithm. Every finite set of tangent lines gives a finite upper-envelope integral on this bounded interval; slope conditions needed for unbounded supports are unnecessary. When the posterior distribution is simply the uniform distribution and may be sampled directly.
For any fixed envelope, proposal times acceptance is proportional to . Conditional on all past evaluations and rejections, the next accepted value therefore has the same normalized posterior density. To see that adaptation does not spoil this, at every attempted draw its accepted mass is a scalar times that fixed posterior density; summing over possible rejection histories preserves it. The acceptance probability stays bounded below by its positive initial-envelope value because insertion only lowers the upper envelope. Thus acceptance occurs almost surely. With fresh independent randomness, successive accepted values are exact independent samples from the posterior distribution, even when the envelope is retained and improved between them.
Past exam of the mathematics course of the University of Cambridge 2018 iii Paper 216 3 b ii Solution Created 2026-10-03 Updated 2026-10-05
Given the parameters and , the coordinates are conditionally independent. Write , , and let denote the observed count. Their full conditional distributions have scalar densitiesEach is proper: the binomial distribution likelihood factor is bounded, and the remaining factor is a proper normal distribution density.
One completely specified exact algorithm is rejection sampling from . DefineFor ,for or , take , and for take . Propose and accept with probability , repeating until acceptance. The accepted density is proportional to the proposal times , exactly . Its acceptance probability is positive, so it terminates almost surely, although it can be inefficient.
An efficient exact alternative is adaptive rejection sampling. The log density hasThus it is a log-concave probability density. Choose one tangent point with positive derivative in the left tail and one with negative derivative in the right tail; these exist because the Gaussian term dominates there. Their tangent upper hull gives an integrable piecewise exponential rejection envelope. Sample that envelope, accept using the target-to-envelope ratio, and add evaluated points to improve it. Concavity guarantees the upper bound, so accepted samples remain exact. Sample each coordinate independently by either method; a finite number of Metropolis steps would not provide the requested exact draws.