Commit 90e1471
Add yatchew_hr_test(null="mean_independence") mode
Mirrors R YatchewTest::yatchew_test(order=0). Closes the placebo
Yatchew R-parity gap from PR #392.
- New keyword-only `null: Literal["linearity", "mean_independence"]`
on `yatchew_hr_test` (default `"linearity"` is bit-exact backcompat).
- `"mean_independence"` fits intercept-only OLS (residuals = dy - mean(dy));
the downstream sigma2_diff / sigma2_W / sort-by-d machinery is shared.
- Wired through both unweighted and survey-weighted code paths
(4-arm dispatch on (null × weighted)).
- `YatchewTestResults` gained `null_form: str = "linearity"` field;
`summary()` renders the correct null-hypothesis title; `__repr__`
and `to_dict()` updated.
- `tests/test_did_had_parity.py::TestYatchewParity` removed the
placebo skip; routes effect rows through `null="linearity"` (R order=1)
and placebo rows through `null="mean_independence"` (R order=0); both
modes share the documented `× G/(G-1)` finite-sample convention shift
and parity holds at `atol=1e-10`.
- New `TestYatchewHRTestMeanIndependence` class (15 tests) covering
happy path, naive Python baseline at `atol=1e-12`, population-variance
closed form, invalid value, default backcompat, mode-agnostic
tie/constant-d rejection, NaN handling, weighted reduction at
w=ones(G) at `atol=1e-14`, weighted non-uniform baseline,
default-under-weights, survey×null orthogonality, the (linearity,
weighted) baseline (4-arm coverage), zero/replicate-weight rejection,
and G<3 mode-agnostic. One additive backcompat case in each of
`TestYatchewHRTest` and `TestYatchewHRTestSurvey`.
- REGISTRY.md HAD § Yatchew note: TODO marker replaced with shipped
description. CHANGELOG.md and TODO.md updated.
Patch-level (additive keyword-only kwarg + additive dataclass field
with default).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent f1d7674 commit 90e1471
6 files changed
Lines changed: 439 additions & 33 deletions
File tree
- diff_diff
- docs/methodology
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | | - | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
0 commit comments