/** * Statistical functions for evaluation analysis. * * Assumptions: * - All inputs are independent observations from normally distributed populations * - Welch's t-test is used (does NOT assume equal variances) * - Confidence intervals use the t-distribution for small samples (df ≤ 30) * and normal approximation (z = 1.96) for larger samples * * Dependencies: simple-statistics (for mean, sampleStandardDeviation, sampleVariance) */ /** * Arithmetic mean. Returns 0 for empty/null input. */ export declare function mean(arr: number[]): number; /** * Sample standard deviation (Bessel's correction: n-1 denominator). * Returns 0 for arrays with fewer than 2 elements. */ export declare function stddev(arr: number[]): number; export type PValueCategory = '<0.001' | '<0.01' | '<0.05' | '≥0.05'; /** * Bucket a t-statistic into a p-value category by comparing |t| to standard * critical-value tables at α = 0.001 / 0.01 / 0.05 (two-tailed). * * Returns one of four buckets instead of a continuous p value. This avoids * implementing the regularized incomplete beta function for an exact CDF * while still giving readers enough resolution to distinguish * "barely significant" from "strongly significant". * * For df > 30 falls back to the normal-approximation critical values. */ export declare function pValueCategory(tStatistic: number, df: number): PValueCategory; /** * Compute 95% confidence interval for the population mean. * * Method: t-interval (appropriate for small samples from normal populations) * Formula: mean ± t(α/2, n-1) × (s / √n) */ export declare function confidenceInterval(arr: number[]): { mean: number; lower: number; upper: number; stddev: number; }; /** * Welch's t-test for two independent samples with unequal variances. * * Tests H₀: μ₁ = μ₂ (no difference in population means) * Uses Welch-Satterthwaite approximation for degrees of freedom. * * Requires at least 2 observations per group. Returns non-significant * result for insufficient data or zero variance in both groups. */ export interface EffectSizeResult { cohensD: number; hedgesG: number; primary: 'd' | 'g' | 'none'; magnitude: 'negligible' | 'small' | 'medium' | 'large' | 'none'; pooledStddev: number; n1: number; n2: number; } /** * Effect size for two independent samples. * * Cohen's d: (mean_a - mean_b) / pooled_stddev * Hedges' g: J * d, where J = 1 - 3 / (4 * (n1 + n2) - 9) * * Hedges' g corrects Cohen's d's small-sample bias (Hedges 1981) and is * preferred when n1 + n2 < 20. For n1 + n2 >= 20 the correction is < 5% * and Cohen's d is the conventional choice. * * `primary` indicates which to emphasize in UI based on total sample size. * `magnitude` uses standard thresholds (|effect| 0.2 / 0.5 / 0.8) applied * to the primary metric. * * Returns effect 0 with primary 'none' for insufficient data or zero variance. */ export declare function effectSize(a: number[], b: number[]): EffectSizeResult; export declare function tTest(a: number[], b: number[]): { tStatistic: number; df: number; significant: boolean; };