fix(stat_run): NaN guards — check_assumptions abstain, scipy CI, emit allow_nan=False#2
Open
kicrazom wants to merge 1 commit into
Open
fix(stat_run): NaN guards — check_assumptions abstain, scipy CI, emit allow_nan=False#2kicrazom wants to merge 1 commit into
kicrazom wants to merge 1 commit into
Conversation
…e_ttest; emit allow_nan=False check_assumptions: NaN Shapiro/Levene p -> working_hypothesis (was "assumptions hold") recompute_ttest: res.df + res.confidence_interval, drop _var (ci95 was [NaN,NaN] at t=0) json_io.emit: allow_nan=False tests: 3 regression tests (json_io + stat_run) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three correctness fixes from a read-only audit of the L0 stat engine. All reproduced as failing tests first (TDD), then fixed.
Fixes
check_assumptions— Shapiro/Levene return NaN for n<3;NaN < 0.05isFalse, so the engine affirmatively reported "parametric assumptions hold" on untestable samples. Now abstains →working_hypothesis("assumptions indeterminate"), surfacestestable: false, leaks no bare NaN.recompute_ttest—se = mean_diff / tgaveci95 = [NaN, NaN]when means are equal (t=0). Now uses scipyres.df+res.confidence_interval(0.95)(finite CI, correct at t=0); removes the now-dead manual Welch df +_varhelper. Non-degenerate output unchanged.json_io.emit— defaultallow_nan=Trueemitted bareNaN, which strict RFC-8259 parsers (JSJSON.parse, Goencoding/json) reject. Nowallow_nan=False→ fails closed to an error envelope.Tests
+3 regression tests (
test_json_io.py,test_stat_run.py). Full suite: 175 passed, 1 skipped; ruff clean.Not included (separate decisions)
permutation_test/multiple_testingreimplement scipy/statsmodels — left as deliberate deterministic-core.🤖 Generated with Claude Code