/** * Paired-comparison statistics for cross-run reports: an exact two-sided sign * test over paired outcomes, and a seeded bootstrap confidence interval for a * paired mean delta. * * Both are distribution-free on purpose. A benchmark run yields few paired * trials (single digits to low tens), the per-trial deltas are integers with * long tails, and the question is "on the same case, did B beat A" — which a * paired sign test answers exactly, without a normality or symmetry assumption * the data cannot support. Ties carry no sign and drop out of the test, as the * sign test requires. * * The bootstrap resamples the observed deltas with replacement, so its interval * needs no shape assumption either, and it is seeded so that re-running * `compare` on the same reports prints a byte-identical table. * * @module dsh-eval/stats */ /** Outcome of an exact two-sided sign test. */ export interface SignTestOutcome { /** Discordant pairs (`wins + losses`); ties drop out of the test. */ discordant: number; /** Exact two-sided p-value; 1 when every pair tied. */ pValue: number; } /** A paired mean delta with its bootstrap interval. */ export interface PairedDelta { /** Mean per-pair delta (`b - a`). */ mean: number; /** Lower interval bound, or null when fewer than two pairs are available. */ lower: number | null; /** Upper interval bound, or null when fewer than two pairs are available. */ upper: number | null; /** Pairs contributing to the mean. */ pairs: number; } /** Knobs for {@link pairedDelta}; defaults keep reports reproducible. */ export interface BootstrapOptions { /** Interval confidence, default `0.95`. */ confidence?: number; /** Resample count, default `2000`. */ resamples?: number; /** PRNG seed, default `0`. */ seed?: number; } /** * Exact two-sided sign test. Under the null hypothesis a discordant pair is a * win or a loss with equal probability, so the win count is Binomial(n, 1/2) * and the p-value doubles the smaller tail. * @param wins - pairs where B beat A. * @param losses - pairs where A beat B. * @returns the discordant count and the exact p-value in `[0, 1]`. */ export declare function signTest(wins: number, losses: number): SignTestOutcome; /** * Mean paired delta with a percentile bootstrap interval. * @param deltas - per-pair differences (`b - a`). * @param options - confidence, resample count, and PRNG seed. * @returns the mean and interval, or null when `deltas` is empty. */ export declare function pairedDelta(deltas: readonly number[], options?: BootstrapOptions): PairedDelta | null;