Commit 0bcda79
Address PR #365 R7 P3: gate _loo_unit_ids on unit-granularity; refresh harness docstring
P3 (Maintainability — survey jackknife still populated _loo_unit_ids):
``fit()`` was unconditionally setting ``_loo_unit_ids`` / ``_loo_roles``
on every jackknife fit, including full-design survey fits where the
underlying replicates are PSU-level and ``get_loo_effects_df()`` now
raises ``NotImplementedError``. Internal / canned guidance keyed off
``_loo_unit_ids is not None`` as the availability check (e.g.,
``practitioner.py``) would still call the accessor on a survey fit and
hit the new raise.
Fix: only populate ``_loo_unit_ids`` / ``_loo_roles`` when
``_loo_granularity == "unit"``; leave them ``None`` on the PSU path so
``_loo_unit_ids is not None`` correctly reports availability.
``_loo_granularity`` is the authoritative accessor gate; the legacy
``_loo_unit_ids`` sentinel now agrees with it.
P3 (Documentation — harness docstring stale):
``coverage_sdid.py::_fit_one`` docstring said "fit() routes [survey
designs] through the bootstrap survey path (PR #352) when
method=='bootstrap'" — stale after the placebo + jackknife full-
design paths landed. Rewrote to describe the three method-specific
survey variance paths (weighted-FW + Rao-Wu bootstrap; stratified-
permutation + weighted-FW placebo; PSU-LOO + stratum-aggregation
jackknife) and mention the Case B-D ValueError failure modes alongside
NotImplementedError.
Verification: 94 passed (no behavior change on the gating fix — it's
a state-gating tightening, not a correctness change).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 6d27a57 commit 0bcda79
2 files changed
Lines changed: 20 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
297 | 297 | | |
298 | 298 | | |
299 | 299 | | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
304 | 308 | | |
305 | 309 | | |
306 | 310 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1128 | 1128 | | |
1129 | 1129 | | |
1130 | 1130 | | |
1131 | | - | |
1132 | | - | |
1133 | 1131 | | |
1134 | 1132 | | |
1135 | 1133 | | |
| |||
1143 | 1141 | | |
1144 | 1142 | | |
1145 | 1143 | | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
1146 | 1156 | | |
1147 | 1157 | | |
1148 | 1158 | | |
| |||
0 commit comments