Skip to main content

paired_bootstrap_interval

Function paired_bootstrap_interval 

Source
pub fn paired_bootstrap_interval(
    differences: &[f64],
    level: f64,
    resamples: u32,
    seed: u64,
) -> Option<(f64, f64)>
Expand description

The paired bootstrap’s percentile interval on the mean of differences, at level: the paired difference of two methods’ errors on the same flights, resampled by flight, as ADR-257 §3 asks for the private collection’s flights.

Each of resamples resamples draws n of the n differences with replacement, each index equally likely, from a xoshiro256++ stream seeded with seed (hpr_core::random), and takes their mean. The interval runs from the resample means’ (1 − level)/2 quantile to their (1 + level)/2 quantile, each the smallest mean at or below which that share of the means lies (B. Efron and R. J. Tibshirani, An Introduction to the Bootstrap, Chapman & Hall, 1993, §13.3, the percentile interval). Pairing keeps each flight’s two errors together, so what the flights share cancels in the difference.

It is approximate: on a few flights it can cover less than level (Efron and Tibshirani, §13.5), which is why the public flights’ report, on 7 flights at most, gives sign_flip_interval instead. Same differences, level, count and seed, same interval, bit for bit.

It keeps every resample’s mean, 8 bytes each: 10,000 resamples take 80 kB. On n flights a resample of one flight n times comes (1/n)ⁿ of the time; where that is at least (1 − level)/2 (3 flights or fewer at 95%) both ends are the smallest and largest difference, and the interval is only their range.

Returns None for no differences, no resamples, a level not inside 0 to 1, a difference that isn’t finite, or an interval end that isn’t finite (a mean overflowing in more than the tail’s share of the resamples).