Skip to content

LEAP Numerical Verification

LEAP's numerics are verified against external reference data and closed-form solutions, not against self-consistency. This document describes the methodology and the current verification state. For the full validated matrix see support-matrix.md.

NIST StRD certification fixtures

Reference fixtures live in tests/fixtures/nist/ (SHA-256 checksums in tests/fixtures/nist/SHA256SUMS.txt, 11/11 verified). They are used by crates/leap-stats/tests/nist_certification.rs:

  • OLS coefficients / statistics vs NIST StRD fixtures: Norris, Pontius, Longley, Filip, Wampler1 (5 fixtures).
  • Descriptives (mean/SD/lag-1) vs NIST StRD: Pidigits, Michelso, NumAcc1, NumAcc4.
  • ANOVA F / R² / residual SD vs NIST StRD: sirstv, smls01.

Reference statistical parity checks

Closed-form and recovery checks per test suite:

  • G4 (g4_validation.rs): one/two/paired t-tests (incl. Welch pooled), known two-sided p-values; Mann-Whitney U, Wilcoxon signed-rank, Kruskal-Wallis, Spearman and Kendall tau-b (with ties); Fisher's exact (Lady Tasting Tea), chi-square, G-squared, odds ratio + Haldane, zero-cell Haldane; logistic and Poisson GLM recovery + deviance; PCA (orthogonality, known eigenvalues); k-means++ (two blobs); method-of-moments normal/lognormal/exponential/Weibull fits; Anderson-Darling normality; AIC consistency.
  • G5 (g5_engineering_validation.rs): full/fractional factorial (2^k, 2^(k−p)), Plackett-Burman (n=12), CCD rotatable alpha & geometry; quadratic stationary point (exact recovery); D-optimal vs random design efficiency ordering; Derringer-Suich composite desirability; Xbar-R/Xbar-S/I-MR/P-C-U charts (closed form); Nelson rules (all triggers); capability indices (Cp/Cpk/Pp/Ppk within and non-normal) and PPM; Gage R&R crossed and nested (variance components, closed form); Kaplan-Meier steps + Greenwood SE; Log-Rank exact chi-square; Weibull/lognormal/exponential MLE (right/interval censoring); Cox PH hazard-ratio recovery; Arrhenius Ea recovery.
  • Panel ↔ core parity: crates/leap-app/tests/g5_parity.rs (9 tests) asserts that the in-panel implementations agree with leap-stats on the quantities that must match, and explicitly documents intentional differences (e.g. in-module SPC constants).

Floating-point precision

  • All core math is f64. Non-finite values (NaN/Inf) are serialized as null in CLI JSON output.
  • Tolerances are predeclared per ADR-0004 and research/results/R07/tolerance_policy.json; they are not widened to make a failing implementation pass. Documented exceptions (e.g. NumAcc4 SD tolerance) are recorded in the test files themselves.
  • Panel implementations may differ in last-decimal conventions from the validated leap-stats core; parity tests assert agreement on the quantities that must match.

Deterministic seeded RNGs

Every stochastic procedure in the core is seeded and deterministic:

  • k-means++ seeding and D-optimal design search seeds are explicit.
  • DOE --randomize uses --seed (default 0) for deterministic run-order shuffling.
  • Bayesian MCMC (leap bayes mcmc) uses --seed (default 12345) with --chains/--warmup/--draws (defaults 4/200/200).
  • A-B analysis (leap bayes ab) uses --seed and --n-draws (default 1000).
  • CCD/Box-Behnken/optimal design generation use --seed.

Reproducible verification

LEAP verification is 100% offline and lockfile-pinned. Run the complete test suite, release build, and GPL license audit locally at any time:

bash scripts/check.sh
cargo build --release --offline --locked
python3 scripts/audit_licenses.py --check

The full test suite is deterministic and offline; .gitignored artifacts and tmp dirs are excluded. All commands honor the committed Cargo.lock via --locked and never fetch from the network via --offline.