Commit 91eb2c7
Round-6 CI P1: narrow analytical guard to within-group-varying PSU only
The round-5 analytical guard in _survey_se_from_group_if was over-
scoped: it fired on any panel with leaked centered mass, including
PSU-within-group-constant regimes (PSU=group auto-inject, strictly-
coarser-PSU-within-group-constant). But the docs said those regimes
are the intended workaround. Panels with terminal missingness and
PSU=group are the documented supported path and must not raise.
Fix: add an analytical dispatcher inside `_survey_se_from_group_if`
mirroring the bootstrap's `_psu_varies_within_group` routing. When
PSU is within-group-constant on the eligible subset, fall back to
the legacy group-level allocator (which uses U_centered[g] directly
via the row-sum identity and does not trigger the sentinel-mass
guard). Only when PSU actually varies within group does the cell
allocator run — and only then can the sentinel-mass guard fire.
Byte-identity: under PSU=group the row-sum identity makes the cell
and group allocators statistically equivalent, but the legacy
branch was the one in use before PR #323 introduced the cell
allocator. Rerouting to it under within-group-constant regimes is
a regression-free fallback (it's what PR #323 aimed to preserve
via byte-identity in the first place).
Test coverage: added `test_fit_succeeds_on_terminal_missingness_with_psu_group`
— same fixture as the varying-PSU failure regression but with
auto-inject `psu=<group>`, asserts both `n_bootstrap=0` and
`n_bootstrap > 0` succeed with finite SE.
Also updated the cell-level bootstrap `ValueError` text (and the
_unroll_target_to_cells docstring) to no longer advertise
`n_bootstrap=0` as a workaround — both paths now fail consistently
on the varying-PSU carve-out, and the correct workaround is
pre-processing or using an explicit `psu=<group_col>`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 262fc61 commit 91eb2c7
3 files changed
Lines changed: 103 additions & 7 deletions
File tree
- diff_diff
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5863 | 5863 | | |
5864 | 5864 | | |
5865 | 5865 | | |
| 5866 | + | |
| 5867 | + | |
| 5868 | + | |
| 5869 | + | |
| 5870 | + | |
| 5871 | + | |
| 5872 | + | |
| 5873 | + | |
| 5874 | + | |
| 5875 | + | |
| 5876 | + | |
| 5877 | + | |
| 5878 | + | |
| 5879 | + | |
| 5880 | + | |
| 5881 | + | |
| 5882 | + | |
| 5883 | + | |
| 5884 | + | |
| 5885 | + | |
| 5886 | + | |
| 5887 | + | |
| 5888 | + | |
| 5889 | + | |
| 5890 | + | |
| 5891 | + | |
| 5892 | + | |
| 5893 | + | |
| 5894 | + | |
| 5895 | + | |
| 5896 | + | |
| 5897 | + | |
5866 | 5898 | | |
5867 | 5899 | | |
5868 | 5900 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
614 | 614 | | |
615 | 615 | | |
616 | 616 | | |
617 | | - | |
618 | | - | |
619 | | - | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
620 | 624 | | |
621 | 625 | | |
622 | 626 | | |
| |||
658 | 662 | | |
659 | 663 | | |
660 | 664 | | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
665 | 673 | | |
666 | 674 | | |
667 | 675 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2186 | 2186 | | |
2187 | 2187 | | |
2188 | 2188 | | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
2189 | 2245 | | |
2190 | 2246 | | |
2191 | 2247 | | |
| |||
0 commit comments