From 9d2e8081087564649a801ebee906c8dc9d909ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Minarowski?= Date: Thu, 2 Jul 2026 22:17:57 +0200 Subject: [PATCH] docs(stat_run): note permutation_test/multiple_testing are deliberate deterministic-core Record why they reimplement scipy/statsmodels rather than wrap them (byte-stable across library versions + envelope provenance fields), so the reimplementation is not "simplified" away. Co-Authored-By: Claude Opus 4.8 (1M context) --- scripts/core/stat_run.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/core/stat_run.py b/scripts/core/stat_run.py index 24210de..2c77cbc 100644 --- a/scripts/core/stat_run.py +++ b/scripts/core/stat_run.py @@ -187,6 +187,10 @@ def permutation_test(req): (it is a stochastic estimate of the same exact p, hence corroborated_inference not operational_fact). + Deliberately reimplemented, not a thin scipy wrapper: output must be byte-stable across + scipy versions and carry the envelope's provenance fields (exact/seed/n_combinations). + This is the deterministic core — do not "simplify" to scipy.stats.permutation_test. + Input: {op, groups:[a,b], alternative?: two-sided|less|greater, n_resamples?: int, exact_max_perms?: int} """ @@ -264,6 +268,10 @@ def multiple_testing(req): hypotheses survive alpha — is only as strong as the input p-values, so the claim is scoped to "adjustment computed", NOT "these effects are real". + Deliberately reimplemented, not a statsmodels wrapper, for the same deterministic-core + reason: byte-stable adjusted p-values across library versions. Do not "simplify" to + statsmodels.stats.multitest.multipletests. + Input: {op, pvalues:[...], alpha?: float (default 0.05)} """ pvals = list(map(float, req["pvalues"]))