Likelihood weighting Created 2026-10-25 Updated 2026-10-31
Likelihood weighting uses observation likelihoods as importance weights. If parameters are drawn independently from their prior distribution , weight a draw by and estimate a posterior expectation of by . With positive finite evidence and integrable weighted quantities, the strong law of large numbers proves consistency of this self-normalized importance sampling ratio. Finite-sample bias and concentration of the weights remain possible. A different proposal requires the additional prior density-to-proposal density ratio.
For target and proposal , this is the importance weight. Assuming only , the weighted estimator has guaranteed finite variance for , since . For every , choosing with gives finite target second moment but infinite weighted second moment. With the additional assumption that is bounded, the sufficient range is instead . The integrand hypothesis therefore matters.
With , , and as above, independence of the draws gives the variance of a sample mean:This formula allows infinite variance. To identify the optimum, write . ThenThe last equality uses . Its nonnegative integrand provesIndeed, all importance weights then equal . This is a formal optimum: evaluating the normalized posterior density generally already requires the unknown marginal likelihood.
Poor coverage of regions with substantial posterior mass produces large weights. In particular, excessively light proposal tails, a proposal that is too narrow, or a missed mode can make enormous or infinite. A proposal that is unnecessarily diffuse can also waste nearly all draws on negligible posterior probability. Omitting target support altogether violates unbiasedness, rather than merely increasing variance.
Put and . The support condition for importance sampling is essential: almost everywhere that . For one draw , the importance weight satisfiesBy linearity of expectation,This proves that it is an unbiased estimator. If the proposal omits a region of positive target mass, the expected value instead misses that region's contribution; the unconditional unbiasedness claim needs the stated support condition for importance sampling.
Past exam of the mathematics course of the University of Cambridge 2002 iii Paper 40 2 a i Solution Created 2026-10-03 Updated 2026-10-14
Assume independent samples , , and wherever can contribute. The importance weight is , and the ordinary importance sampling estimator isIts expectation is , by cancellation of in the expectation integral. The strong law of large numbers gives almost-sure convergence to . Common probability support is sufficient; the precise support condition for importance sampling only requires covering the nonzero integrand for this particular expectation.
Past exam of the mathematics course of the University of Cambridge 2002 iii Paper 40 2 b iv Solution Created 2026-10-03 Updated 2026-10-14
For , the indicator is always one, and the importance weight reduces toAveraging these independent contributions givesAs a direct normalization check, its expectation is . For this equals , the exact standard Cauchy distribution tail probability. The substitution , rather than with the same symbol left unchanged, explains why the displayed denominator contains .
Past exam of the mathematics course of the University of Cambridge 2004 iii Paper 40 4 i Solution Created 2026-10-03 Updated 2026-10-14
Assume the draws are independent from , that the target-weighted integrand is covered by its support, and that . Define the importance weight . The change-of-density identity isTherefore importance sampling uses the unbiased estimatorThe strong law of large numbers gives consistency. A finite second moment of the weighted integrand additionally gives finite variance and a usual independent-sample central limit theorem. A useful proposal places enough probability where is large and avoids tiny proposal probability density function there; common support alone does not guarantee finite variance.
Past exam of the mathematics course of the University of Cambridge 2023 iii Paper 216 2 c Solution 2026-09-28
Let be the importance weight. The two normalized densities giveSince , there is a finite constant such that everywhere. The Independence Metropolis–Hastings algorithm has an accepted transition density satisfyingConsequently the whole state space is a small set, with the one-step minorization condition . Iterating this Doeblin condition gives uniform geometric convergence in total variation distance, so the chain is geometrically ergodic.
I would first collapse the duration noises as in part (c), then use self-normalized importance sampling on the two shared parameters. Draw independent , give each the importance weight , and returnThis is likelihood weighting: the observations affect the weights rather than forcing repeated simulation of twenty latent inequalities. Integrating out both the constraints' auxiliary randomness and the future Boolean query is Rao-Blackwellization; at fixed parameters it removes randomness without changing the relevant conditional expectations.
The weights and weighted queries lie in , and the evidence is positive. The strong law of large numbers therefore makes the numerator and denominator averages converge to their corresponding integrals, proving almost sure convergence of their ratio to part (d). The finite- ratio is generally biased; the assertion concerns consistency rather than a finite-sample unbiased estimator. Use logarithms of importance weights to avoid numerical underflow:
def weighted_answer(n, rng):
if n <= 0:
raise ValueError("n must be positive")
samples = []
for _ in range(n):
mu = rng.uniform(0.0, 60.0)
sigma = rng.uniform(1.0, 20.0)
samples.append((journey_loglik(mu, sigma),
math.exp(5.0 * normal_logcdf((mu - 30.0) / sigma))))
offset = max(logw for logw, h in samples)
if not math.isfinite(offset):
raise ArithmeticError("all weights underflowed")
scaled = [(math.exp(logw - offset), h) for logw, h in samples]
den = math.fsum(w for w, h in scaled)
answer = math.fsum(w * h for w, h in scaled) / den
ess = den * den / math.fsum(w * w for w, h in scaled)
return answer, essThe returned effective sample size of importance sampling is a concentration diagnostic, not a proof of accuracy. Repeat runs and inspect the weights. If the prior is much broader than the posterior, improve the proposal with the corresponding importance sampling density correction, or use the Metropolis–Hastings algorithm targeting . Because this particular collapsed problem is only two-dimensional, deterministic numerical integration is also an excellent independent accuracy check; it was used for the figure and numerical illustration. Straight rejection of the original traces is correct but wastes most proposals here.
The importance weight for the two normal densities isUse with . Its second moment before averaging isFor the source's general assumption , a guaranteed range isIndeed there, so .
This range cannot be enlarged uniformly over all such . If , choose withThen but the displayed weighted second-moment integral diverges. Thus no variance range depending only on can characterize every individual integrand beyond the guaranteed range.
If an additional boundedness assumption on is intended, the familiar sufficient range becomes . For this condition is also necessary, but a compactly supported can have finite weighted variance for every . Distinguishing these assumptions prevents imposing an unstated restriction on the source integrand.
An importance weight has expected value . From the ratio in (a),The supplied normal distribution transform applies with quadratic coefficient , giving each factor . ThusFor , the base exceeds one because : importance weight variance increases exponentially with dimension. For , the importance weight is identically one and its variance is zero. This calculation concerns the importance weight, rather than the weighted integrand.
The integrand is positive, so the minimum-variance importance distribution is its target-weighted probability density function, normalized by :By completing the square,Thus is the multivariate normal distribution , where is the first standard basis vector. Its importance weight and weighted integrand areA variance cannot be negative, and this proposal makes every summand constant, proving optimality directly. It is admissible under the arbitrary-proposal condition even though its mean vector is not zero. Although optimal proposals usually involve an unknown normalizing integral, here both that integral and the resulting normal distribution are explicit.
At equal sample count, rejection sampling eventually has smaller variance for fixed ; at equal expected proposal cost, importance sampling eventually wins. The distinction matters because a sample of the rejection sampling estimator means an accepted draw.
For the importance sampling estimator, all coordinates contribute to the importance weight although only one enters the integrand. The same normal distribution transform as in (c), now with linear coefficient for coordinate one, givesBoth estimators are unbiased estimators of , andFor fixed , the first variance grows exponentially while the second stays constant. This is the benefit of returning exact target draws in rejection sampling. However, obtaining those draws costs proposals each on average.
To compare computational work, multiply each variance by its expected proposal count. For importance sampling that count is ; for rejection sampling it is . The ratio of the resulting cost-normalized variances isbecause . Thus importance sampling eventually gives better precision for the same expected number of proposals, assuming comparable work per proposal. This is an asymptotic cost comparison, not a guarantee that a fixed small computing budget produces any accepted draws. Both methods still deteriorate exponentially in this comparison. For they coincide and every proposal is accepted.
Sample-count and expected-proposal-cost comparisons for the one-coordinate integrand at sigma squared equal to two
. Details. A practical improvement is to exploit the integrand's one-coordinate structure directly: average for standard normal distribution draws , without generating unused coordinates. The optimal change of proposal distribution in (iii) improves further.
Draw independent and identically distributed random variables and use the importance weight . The importance sampling estimator isThe envelope supplies the support condition for importance sampling. Since , this is an unbiased estimator. Moreover, , soHere . Subtracting the squared expected value and dividing by proves the bounded-weight importance-sampling moment bound in the requested form:
For the proposed joint probability density , define the acceptance indicator functionOn the proposal's support the importance weight is . Therefore the requested augmented-space importance sampling estimator isIts expected value is , provided . This is not the ordinary estimator from question 1. Taking the conditional expectation of this augmented estimator given all produces that ordinary estimator, because . This is the Rao-Blackwell identity for a fixed-denominator rejection estimator.
