Published by the Warwick Analytics Society

Science & Tech

When does equal precision stop being optimal?

The short answer

When a simulation’s sampler is much worse in one band of losses than in the next. Then giving every risk threshold the same precision wastes draws, and pooling neighbouring bands lowers the worst error. In my tests that gain was small next to the damage a poor sampler did

Banks, insurers and engineers often need the chance that a loss goes past several levels at once, such as losing more than £1m, £5m or £20m in a year. One way to get these is to run a model thousands of times and count how often each level is passed. The trouble is that the biggest losses hardly ever come up, so plain simulation needs a huge number of runs to pin them down.

Importance sampling gets round this. It simulates bad outcomes far more often than they really happen, then gives each one a smaller weight so the estimates still come out right. When one simulation serves several thresholds, you also have to decide how to split the draws between the bands of losses, from one threshold to the next and, for the last band, beyond the top one.

If the sampler inside each band were perfect, the best split would give every threshold the same relative error. This is called equal precision. Real samplers are never perfect, so I wanted to know when equal precision is still the best split, meaning the one that makes the largest of the errors as small as possible, and what to do when it isn’t.

Findings

Equal precision only works when the sampler is about as good in every band

I measure how far a band’s sampler is from perfect with its inflation factor, which is 1 for a perfect sampler and gets bigger the noisier its weights are. Equal precision stays the best split as long as the sampler doesn’t get too much better from one band to the next. How much is too much depends on how quickly the thresholds get rarer. If each is half as likely to be passed as the one before, the inflation factor can fall by up to about four times between neighbouring bands. The exact test is in the method section.

Take two thresholds, one passed 10% of the time and one 5% of the time. Say the sampler for the band between them has an inflation factor of 100 and the sampler beyond the 5% threshold is perfect. Equal precision puts 97% of the draws in the first band and 3% in the second. The pooled split, which is the best possible here, puts 91% and 9%.

The pooled split cuts the worst error and sharpens the rarer estimate

Relative error at each threshold with 10,000 draws, when the sampler in the first band has an inflation factor of 100 and the one beyond the second threshold is perfect

Equal precision Pooled split Passed 10% of the time 5.8% 5.4% Passed 5% of the time 5.8% 3.2% Equal precision Pooled split Passed 10% of the time 5.8% 5.4% Passed 5% of the time 5.8% 3.2%
ThresholdEqual precisionPooled split
Passed 10% of the time5.8%5.4%
Passed 5% of the time5.8%3.2%

Source: author’s calculations

With 10,000 draws, the pooled split cuts the worst relative error from 5.8% to 5.4%, and the 5% threshold’s error falls from 5.8% to 3.2%. Equal precision does worse because it holds the rarer threshold back. Its band is cheap to estimate well, so to keep it from being more precise than the 10% threshold, equal precision gives it very few draws. But those draws also count towards the 10% estimate, so starving the band makes the worse estimate worse too.

The fix is to pool neighbouring bands

When the test fails, the best split comes from pooling. Each band gets a score, and the scores should rise as the losses get rarer. Wherever one band’s score is higher than the next band’s, the two are merged into a block with a combined score, and the merging carries on until the scores rise all the way. The first threshold of each block then has the worst error, and the thresholds inside a block come out more precise.

This is the pool adjacent violators algorithm, a standard tool for fitting a line that can only go up, and it takes one pass through the bands. The split it gives is the best possible: no other way of sharing out the draws gets a smaller worst error with the same samplers.

In tests, pooling helped a little and a poor sampler hurt a lot

I tested the method on losses that follow an exponential distribution, where every answer can be worked out exactly. The four thresholds are passed 37%, 14%, 5% and 1.8% of the time, and each run uses 5,000 draws. The samplers for the second and third bands are perfect and the last band’s is close to perfect, with an inflation factor of 1.1. I made the first band’s sampler good, poor or very poor, with inflation factors of 1, 21 and 459.

A poor sampler cost far more than the choice of split

Worst relative error across the four thresholds with 5,000 draws, by how the draws are split and how good the first band’s sampler is (inflation factors of 1, 21 and 459)

How the draws are splitGoodPoorVery poor
Plain simulation10.4%10.4%10.4%
Equal shares per band2.6%8.1%38.3%
Equal precision1.7%4.6%20.7%
Pooled split1.7%4.6%19.6%
Pooled, learned from a pilot1.8%6.0%28.6%
Pooled, fixed draws per band0.4%4.0%19.2%

Source: author’s calculations. All figures are exact except the pilot row, which comes from 800 simulated runs

With a good sampler everywhere, equal precision was already the best split. Its worst error was 1.7%, against 10.4% for plain simulation with the same number of draws.

With a poor first band, pooling it with the second cut the worst error from 4.63% to 4.59%, and the second threshold’s error fell to 3.68%. Splitting the draws equally between the bands did much worse, at 8.1%.

With a very poor first band, pooling the first three bands cut the worst error from 20.7% to 19.6%. But plain simulation, at 10.4%, beat every split. No way of sharing out the draws makes up for a bad sampler.

Two other results matter in practice. The same pooling rule gives the best split when the number of draws in each band is fixed in advance, which is called stratified sampling, and that beat the pooled split in all three cases. And because nobody knows the inflation factors in advance, they have to be estimated from a small pilot run first. Across 800 simulated runs, that cost some accuracy, with worst errors of 1.8%, 6.0% and 28.6%.

Method

Each draw first picks a band, band j with probability zj, then draws a loss from that band’s sampler. The estimate for each threshold is the weighted share of draws that pass it, where a draw’s weight is the true density of that loss divided by the density it was drawn from, so every estimate is unbiased.

For band j, mj is the chance of a loss landing in it and cj is the mean square of the true density divided by the band sampler’s density, when drawing from that sampler. A perfect sampler gives every draw in the band the same weight, so cj = mj2, and the inflation factor is cj/mj2. With n draws, the relative variance of the estimate for threshold i is (Fi − 1)/n, where Fi adds up cj/zj over the bands beyond threshold i and divides by pi2, the square of the chance of passing it. The best split makes the largest Fi as small as possible.

A band’s score is √cj divided by pj2 − pj+12, using the chances of passing its lower and upper thresholds, with 0 for the top of the last band. Equal precision is the best split exactly when the scores never fall from one band to the next. Otherwise, pooling merges bands into blocks, and a block’s score is its total √cj divided by its total pj2 − pj+12. Each band’s share of the draws is then proportional to √cj times its block’s score. Every threshold that starts a block reaches the same F, the ones inside a block stay at or below it, and a matching lower bound shows that no split does better.

In the tests, losses follow an exponential distribution with rate 1, and the thresholds are 1, 2, 3 and 4. The samplers in the first three bands are exponential distributions cut off at the band’s edges. The first band’s rate is 1, 8 or 12 and the other two bands’ rate is 1, which makes them perfect. The last band’s sampler is an exponential with rate 1.3. Relative error is the root mean squared error as a share of the true probability, and the table gives the largest of the four.

Every figure in the table comes from these formulas, except the pilot row. For that, each of 800 runs takes 100 pilot draws per band, counted in its 5,000, estimates mj and cj from them, pools, and spreads 5% of the draws evenly across the bands as a safeguard. The stratified row uses the same pooling rule with each band’s variance, cj − mj2, in place of cj, and gives every band at least one draw.

Limitations

The result covers one kind of design, where each draw picks a band at random and the samplers inside the bands are fixed. It says nothing about how to build a good sampler in the first place, which, as the very poor case shows, matters more.

The tests are one-dimensional, so the exact answers are known. Real risk models have many inputs, and finding the bands and building samplers for them is the hard part. The draw counts also leave out the computing time spent building the samplers.

The pilot row comes from simulation, so it has some sampling error. With the very poor sampler, a few rare and very large weights drive most of the error, and 800 runs can miss them. In that case the simulated errors for other splits came out up to about 15% below their exact values, so the 28.6% is probably too low.

The general theory of the best samplers for several targets at once is in Beh and Morio’s recent paper, and pool adjacent violators is a standard algorithm. What this piece adds is the worked-out answer for nested thresholds when the samplers inside the bands are fixed.

Sources

  1. J. Beh and J. Morio, Optimal Importance Sampling Densities for Estimating Several Expectations at Once. arXiv, 2026
  2. J. de Leeuw, K. Hornik and P. Mair, Isotone Optimization in R: Pool-Adjacent-Violators Algorithm (PAVA) and Active Set Methods. Journal of Statistical Software 32(5), 2009
  3. T. Vidal, D. Gribel and P. Jaillet, Separable Convex Optimization with Nested Lower and Upper Constraints. INFORMS Journal on Optimization 1(1), 71–90, 2019
  4. H. Y. He and A. B. Owen, Optimal Mixture Weights in Multiple Importance Sampling. arXiv, 2014
  5. J. Demange-Chryst, F. Bachoc and J. Morio, Efficient Estimation of Multiple Expectations with the Same Sample by Adaptive Importance Sampling and Control Variates. Statistics and Computing 33, article 103, 2023
  6. A. Carpentier, R. Munos and A. Antos, Adaptive Strategy for Stratified Monte Carlo Sampling. Journal of Machine Learning Research 16(68), 2231–2271, 2015
  7. P. Glasserman and S. Juneja, Uniformly Efficient Importance Sampling for the Tail Distribution of Sums of Random Variables. Mathematics of Operations Research 33(1), 36–50, 2008
  8. F. Llorente and L. Martino, Optimality in Importance Sampling: A Gentle Survey. arXiv, 2025

Jyotiraditya Padhi

Science & Tech. Mathematics, first year