Skip to main content

bootstrap_ci

Function bootstrap_ci 

Source
pub fn bootstrap_ci(
    values: &[f64],
    statistic: impl Fn(&[f64]) -> f64,
    resamples: usize,
    level: f64,
    seed: u64,
) -> Result<(f64, ConfidenceInterval), MetricError>
Expand description

Percentile bootstrap CI for statistic over values.

Draws resamples resamples of size values.len() with replacement using SplitMix64::new(seed), evaluates the statistic on each, and returns the observed statistic together with the (1 โˆ’ level)/2 and 1 โˆ’ (1 โˆ’ level)/2 percentiles of the resample distribution.

ยงErrors

MetricError::EmptyInput on empty values; MetricError::InvalidLevel for a level outside (0, 1); MetricError::InvalidBinCount if resamples is zero.