Statistics¶
paired_bootstrap and one_sample_bootstrap.
Pure Python, no dependencies.
paired_bootstrap¶
paired_bootstrap(
base: list[float],
derivative: list[float],
n_resamples: int = 2000,
confidence: float = 0.95,
seed: int = 0,
) -> dict
base¶
list[float], required
Per item scores for the base model.
derivative¶
list[float], required
Per item scores for the derivative, aligned with base.
n_resamples¶
int, default 2000
Bootstrap resamples.
confidence¶
float, default 0.95
Interval level.
seed¶
int, default 0
Seed for random.Random.
Raises ValueError when the lists differ in length or are empty.
Returns
-
nint: Number of pairs. -
base_meanfloat: Mean ofbase. -
derivative_meanfloat: Mean ofderivative. -
deltafloat: Mean ofderivative - base. -
ci_lowfloat: Lower interval bound. -
ci_highfloat: Upper interval bound. -
confidencefloat: Interval level. -
significantbool:ci_low > 0 or ci_high < 0.
one_sample_bootstrap¶
one_sample_bootstrap(
values: list[float],
n_resamples: int = 2000,
confidence: float = 0.95,
seed: int = 0,
min_effect: float = 0.0,
) -> dict
Bootstraps values against zero. Returns the same fields as paired_bootstrap, with base_mean equal to 0.0, plus:
-
min_effectfloat: The threshold that was applied. -
significantbool:ci_low > min_effect. Only an increase above the threshold counts.
Used for output_divergence_kl with min_effect=1e-3.