Change of measure Created 2026-09-24 Updated 2026-09-24
If a measure has density with respect to , then
This identity is the basis of likelihood ratios and importance sampling.
Importance sampling of a Cauchy tail Created 2026-10-14 Updated 2026-10-25
For uniform on , has density on . The importance sampling weight for the standard Cauchy distribution tail is , and its expectation is the target tail probability. Writing gives and by integrating . The weight varies only between and , making its variance much smaller than that of a rare-event indicator. This is a comparison of sampling variances, not a deterministic ordering of every pair of empirical variance estimates.
For and , the proposal minimizes the variance of the ordinary unbiased importance sampling estimator. The Cauchy-Schwarz inequality gives , so the minimum variance for independent samples is . The proposal need only cover the nonzero integrand.
For under the posterior density ,
The independent-draw variance of a sample mean therefore yields
Since
we again obtain
The optimum is again generally unavailable as an evaluable normalized density without knowing .
A proposal with too much mass where the posterior density is tiny makes reciprocal weights unstable. In particular, proposal tails that are too heavy relative to the posterior distribution can make infinite. This contrasts with ordinary importance sampling, whose dangerous denominator is . Choosing a normalized restricted to a well-covered posterior region is allowed, although a very small region can make most draws contribute zero and increase variance. Taking gives the Harmonic mean estimator of Bayesian model evidence, illustrating why very small likelihood values can cause severe instability.
A weighting function must first be normalized to a probability density. The constant choice on means
Equivalently, transform and use the already normalized on . Independent samples give the unbiased Monte Carlo integration estimator
function uniform_monte_carlo(f, a, b, N):
    require N >= 2
    total = 0
    total_squared = 0
    for j in 1,...,N:
        u = independent_uniform_0_1()
        value = f(a+(b-a)*u)
        total += value
        total_squared += value*value
    average = total/N
    sample_variance = (total_squared-N*average*average)/(N-1)
    integral = (b-a)*average
    standard_error = abs(b-a)*sqrt(sample_variance/N)
    return integral, standard_error
For a general positive normalized importance density , replace each sample contribution by with . Here the uniform choice is the special case of importance sampling that assigns equal weight to every region of equal length.
The constant density is reasonable when the integrand has comparable magnitude throughout the interval. It is inefficient for a narrow peak because most samples contribute little while rare samples carry large weights.
For independent importance sampling,
A good density has support wherever , is easy to sample and evaluate, and resembles . Subject to normalization, minimizes this variance. For nonnegative , the ideal normalized choice makes every sample contribution equal, although its normalization is generally the unknown integral itself. Uniform weighting is therefore acceptable for a flat integrand, not universally suitable.
Most high-dimensional phase space has negligible equilibrium probability. Uniform sampling spends nearly all its work in these irrelevant regions and seldom visits the small subset that dominates the partition function or the numerator of an equilibrium average. The resulting estimator can have enormous variance.
Importance sampling places samples where the product of statistical weight and observable matters. Sampling the Boltzmann distribution, for example, converts a weighted phase-space integral into an equilibrium expectation. If a Markov chain Monte Carlo algorithm is used, adequate exploration of separate free-energy basins and allowance for autocorrelation remain necessary.
Assume independent samples , , and wherever can contribute. The importance weight is , and the ordinary importance sampling estimator is
Its 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.
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 is
Therefore importance sampling uses the unbiased estimator
The 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.
For the standard Cauchy distribution tail, use the indicator
Then is the desired probability, and the ordinary importance sampling estimator is . The proposal must cover the nonzero integrand, namely the upper tail. A proposal restricted to cannot directly estimate this indicator integral; part (v) instead uses a complementary bounded-interval identity.
Take , so the proposal is the uniform distribution on , with probability density function . Symmetry of the standard Cauchy distribution gives
Thus the proposed expression is exactly the unbiased importance sampling estimator of this complementary integral:
It has finite variance because is bounded on . Explicitly,
These follow from the antiderivatives of and . The target itself is . At it is exactly without simulation; for negative the printed uniform-interval construction must be changed.
The accepted values have marginal posterior density
Estimate this one-dimensional density by a histogram or kernel density estimation from the simulated values. Where , likelihood reconstruction from posterior simulation gives
Use bins or a sufficiently fine grid, and refine near the maximum. For a histogram with bins , its posterior mass divided by prior mass estimates a prior-weighted average of the likelihood in that bin:
Narrowing the bins gives pointwise likelihood reconstruction at continuous positive-prior points. A flat proper prior over the search interval makes the highest posterior-density bin approximately the highest-likelihood bin. With a nonconstant prior, maximizing the posterior alone gives a maximum a posteriori estimate, generally different from maximum likelihood estimation. Choose prior support covering the intended search region and include a possible boundary maximum; for , decreases with , so the maximum-likelihood estimate is .
The sampled genealogies provide a second likelihood reconstruction when the one-dimensional prior integral is computable. Put
Their posterior density is . Therefore, for any trial value ,
This is an importance sampling estimate of the likelihood curve using the posterior genealogies. It can be maximized over a grid without estimating a posterior density in , provided wherever the target integrand is positive and the weights are numerically usable. The ordinary moment estimate is not automatically a maximum-likelihood estimate: it uses only the mean equation, while the likelihood integrates the entire random branch-length distribution.
For independent draws from a normalized proposal , use the importance sampling identity
Thus the unbiased estimator and its variance are
The probability support condition is wherever , and the variance formula requires a finite second moment. Since both probability densities are normalized, no self-normalization of weights is needed.
In the proposed example, normalize to on . It is sampled by for uniform . Taking gives
As a check, . The second moment of one weighted observation is
so . The weight's singularity at zero does not make this variance infinite.
To prove the optimal proposal rule, apply the Cauchy-Schwarz inequality:
Equality holds when the two factors are proportional almost everywhere, giving the minimum-variance importance distribution
For the present nonnegative integrand, normalization gives
Under this proposal, is constant, so the variance is exactly zero. If sampling is wanted, its distribution function is , with inverse . In general the optimal proposal's normalizing constant can itself be the unknown integral, limiting this zero-variance construction's practical use.
For with uniform on ,
Thus has a Pareto distribution and is the importance sampling proposal, concentrated on the required tail. The target tail integrand is , so its importance weight is
The function returns . Since , it is an unbiased estimator. For its second moment,
An antiderivative is , so the integral is . Independence of the proposals gives
This is importance sampling of a Cauchy tail, with weights between and . Their narrow range explains the much smaller variance than the indicator estimate, without appealing to nonexistent Cauchy moments.
An unordered bootstrap sample is determined by the multiplicities of the distinct observations, with . Conversely each such vector specifies exactly one sample up to rearrangement. Place identical marks into boxes using separators. The stars and bars argument therefore gives
These bootstrap count vectors are not equally likely: the probability of a vector is , counting its possible ordered sequences. The ordered index sequences themselves number .
The first simulation uses independent standard Cauchy distributions and returns
The tail probability and estimator moments are
The indicator count has a binomial distribution with parameters ; the infinite variance of a Cauchy observation is irrelevant because this estimator averages bounded indicators.
For the next code block, each row is an independent sample of size from the empirical distribution of the original . Its entry in the vector is the corresponding bootstrap indicator mean . The last expression is the variance of these replicate estimates, with denominator :
Condition on the original data and write a star on bootstrap expectations. Every resampled indicator has a Bernoulli distribution with success probability , and the draws within a row are independent. Thus the conditional bootstrap variance of a sample mean gives
It estimates the sampling variance of the tail-probability estimator, not the variance of the raw Cauchy data. Its square root is an estimated standard error. Finite leaves bootstrap simulation noise. Averaging over the original data, its expectation is , so it is not exactly unbiased for the true variance at finite .
In the importance-sampling block, the transformation gives, for ,
The variable is a proposal draw supported entirely in the integration region. The deterministic value computed from it is the importance sampling weight
Consequently
The code uses ordinary importance sampling of a Cauchy tail, not self-normalization; itself is neither an observation from the target Cauchy law nor the estimator's summand. The weight compensates for sampling from its proposal law.
The final block bootstraps these same proposal observations and recomputes the weight average in each row. Since is a deterministic function of , this is equivalent to resampling the observed weights . If denotes a replicate, the final output is its sample variance over the replicates. Its conditional expectation is
Its expectation over the original proposal sample is .
The variance reduction can be calculated, rather than inferred just from the appearance of the weights. Write . Then
because an antiderivative of the integrand without its prefactor is . Hence
By comparison, . For the true estimator variances are approximately and respectively. The importance estimator has about 1/1,317 of the indicator estimator's variance, because all proposals land in the tail and the weights remain in the narrow interval .
Thus the last bootstrap output should usually be much smaller than the first, and its expected value is smaller by the same variance ratio. This is not a deterministic ordering of two finite-run outputs: if all the original Cauchy draws happen to be at most two, the first bootstrap variance is zero, while unequal importance weights can still give a positive second variance.
Let where , and set it to zero on the g-null set where . The domination assumption makes there and gives . Integrating it also gives . For iid proposals , the importance sampling estimator is
Cauchy-Schwarz inequality under gives . Direct integration proves unbiasedness, . Moreover
Thus
The iid central limit theorem applies to these finite-variance weighted observations:
If the variance is zero, this denotes the point mass at zero. This is the bounded-weight importance-sampling moment bound.
At a common proposal budget, the two asymptotic variances are
Thus prefer the estimator with the smaller proposal-budget variance; the stated assumptions do not give a universal winner. Importance sampling uses every proposal and avoids an empty accepted sample, but those facts alone do not establish variance dominance. The bound from part (a) only says . If , it does imply that importance sampling is at least as efficient asymptotically.
For explicit nonconstant counterexamples in both directions, take and on , and zero outside, with the sharp envelope . For , direct integration gives , and
The accepted-sample mean is better. For the same densities but , the target variance is unchanged, while and
Importance sampling is now better. This is the variance reversal under additive shifts of an importance-sampling integrand.
There is a useful distinction about the Rao-Blackwell theorem. The weighted importance estimator is the conditional expectation, given the proposals, of the fixed-denominator rejection estimator . It is not the conditional expectation of the random-denominator mean . Rao-Blackwell variance reduction for the former therefore does not prove a comparison with the latter. This is the Rao-Blackwell identity for a fixed-denominator rejection estimator. The appropriate answer is the proposal-budget variance comparison of importance and rejection sampling, with the empty-output convention specified.
Choose a proposal probability density function positive wherever is nonzero, up to null sets, and draw independent and identically distributed random variables from . The ordinary importance sampling estimator is
The support condition for importance sampling and absolute integrability give , so this is an unbiased estimator. Its variance, possibly infinite, is
Let . If , the Cauchy-Schwarz inequality yields
Equality holds for proportional to . Thus the minimum-variance importance distribution and the minimum variance are
For a constant-sign integrand this is zero variance. If , the integrand vanishes almost everywhere and the zero estimator already has zero variance. Requiring the proposal to cover all of the target's support, including where , can exclude ; in that stricter class, approaches the same infimum as . This distinguishes coverage of the integral from coverage of every target event.
Let , and write for the standard normal distribution density. For importance sampling, choose the proposal density , namely the uniform distribution on the target interval. Its importance sampling weight is
For iid uniform draws ,
is an unbiased estimator of the target mean, since its expectation integrates . If one chooses not to evaluate , the self-normalized importance sampling alternative has statistical consistency, but generally is not an unbiased estimator.
Alternatively, draw independent random variables with the standard normal distribution, let and , and use
Conditionally on , the retained draws are iid from the truncated normal distribution, so their average is an unbiased estimator with variance , where is its variance. If the ratio is undefined; one can continue drawing until a prescribed number of retained observations is obtained.
Here importance sampling uses every draw inside the interval, whereas only of the normal proposals are retained. The advantage can also be quantified. Integration using gives
For uniform importance sampling,
For the retained-draw ratio with a fixed total proposal budget, its asymptotic variance coefficient is . Thus this importance choice has substantially smaller error for the same proposal count; it also avoids wasting about two thirds of the standard normal distribution draws. This comparison is specific to this well-matched importance sampling proposal; arbitrary proposal choices do not share this guarantee.