You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Address CI AI review: reject negative first_treat in ContinuousDiD
CI AI re-review flagged (P1) that the previous commit claimed "-inf
will be rejected by downstream validators" in both the code comment
and REGISTRY.md, but no such validator existed. After the `+inf -> 0`
normalization, `first_treat < 0` units fell out of both the treated
(g > 0) and never-treated (g == 0) masks, so the affected units were
silently excluded from the estimator — exactly the axis-E silent
failure the PR was closing.
- ContinuousDiD.fit() now validates `first_treat < 0` explicitly
post-normalization and raises ValueError with the row count. -inf,
-2, and any other negative value are all rejected.
- REGISTRY.md note rewritten to match the implemented behavior.
- Existing -inf test replaced with one that asserts
`pytest.raises(ValueError)` matching the row-count message, plus
a positive regression test confirming +inf warning stays silent
on panels with only valid 0/positive `first_treat` values.
- tests/test_utils.py::test_silent_on_balanced_panel tightened: the
balanced-panel silence assertion now filters on any warning
containing "dropped", so a regression that changed the warning
label would no longer hide a genuine drop signal.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/methodology/REGISTRY.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -720,7 +720,7 @@ See `docs/methodology/continuous-did.md` Section 4 for full details.
720
720
-[ ] Lowest-dose-as-control (Remark 3.1)
721
721
-[x] Survey design support (Phase 3): weighted B-spline OLS, TSL on influence functions; bootstrap+survey supported (Phase 6)
722
722
-**Note:** ContinuousDiD bootstrap with survey weights supported (Phase 6) via PSU-level multiplier weights
723
-
-**Note:** The R-style convention of coding never-treated units as `first_treat=inf` is still accepted and normalized to `first_treat=0` internally, but the estimator now emits a `UserWarning` reporting the row count so the silent recategorization is surfaced (axis-E silent coercion under the Phase 2 audit). Only `+inf` is recoded (matching the R convention); `-inf` passes through untouched and will be rejected by downstream validators. Pass `0` directly to avoid the warning.
723
+
-**Note:** The R-style convention of coding never-treated units as `first_treat=inf` is still accepted and normalized to `first_treat=0` internally, but the estimator now emits a `UserWarning` reporting the row count so the silent recategorization is surfaced (axis-E silent coercion under the Phase 2 audit). Only `+inf` is recoded (matching the R convention). Any **negative**`first_treat` value (including `-inf`) raises `ValueError` with the row count, since such units would otherwise silently fall out of both the treated (`g > 0`) and never-treated (`g == 0`) masks. Pass `0` directly for never-treated units to avoid the warning.
724
724
-**Note:** Rows where `first_treat=0` (never-treated) carry a nonzero `dose` are silently zeroed for internal consistency (never-treated cells must have `D=0` in the dose response). The estimator now emits a `UserWarning` with the affected row count before the zeroing, so unintended nonzero doses on never-treated rows are no longer absorbed without a signal (axis-E silent coercion).
0 commit comments