Skip to main content

bootstrap_ci

Function bootstrap_ci 

Source
pub fn bootstrap_ci(
    data: &[f64],
    statistic: &dyn Fn(&[f64]) -> f64,
    n_boot: usize,
    alpha: f64,
    seed: u64,
) -> (f64, f64)
Expand description

Bootstrap percentile confidence interval for a statistic.

Resamples data with replacement n_boot times, computes the statistic on each resample, and returns the [alpha/2, 1−alpha/2] percentile interval.

§Arguments

  • data - Observed data.
  • statistic - Function computing the statistic from a data slice.
  • n_boot - Number of bootstrap resamples.
  • alpha - Significance level (e.g. 0.05 for 95% CI).
  • seed - RNG seed.

Returns (lower_bound, upper_bound).