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.