HAD fit(): extensive-margin warning + covariates= NotImplementedError#525
HAD fit(): extensive-margin warning + covariates= NotImplementedError#525igerber wants to merge 1 commit into
Conversation
|
Overall Assessment Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
Path to Approval
|
…RY checklist Address CI codex review on PR #525: - P1: add `covariates` to the HAD had.fit(...) signature block in diff_diff/guides/llms-full.txt. tests/test_guides.py pins the guide signature against the real fit() signature, so the new keyword-only param must appear there (non-None raises NotImplementedError for the deferred Appendix B.1 / Theorem 6 covariate-adjusted extension). - P2: tick the REGISTRY HeterogeneousAdoptionDiD implementation-checklist item for the covariates= NotImplementedError trap to [x] / closed (it still described the prior bare-TypeError behavior). 382 guide + HAD tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment ✅ Looks good. The prior P1 guide-signature issue is resolved, and I found no unmitigated P0/P1 findings. Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
Two fit-time UX additions to HeterogeneousAdoptionDiD.fit() with NO change to any estimate or standard error (TODO L73 + L74): - Overall path emits a UserWarning when >=10% of units have an exactly-zero post-period dose (library-convention cutoff _HAD_EXTENSIVE_MARGIN_ZERO_DOSE_FRAC). A substantial untreated mass suggests a genuine extensive margin where a standard DiD may be preferable (de Chaisemartin et al. 2026, Section 2 / Assumption 3). The paper retains small untreated shares (Garrett et al. 12/2954 ~ 0.4%), so the cutoff sits ~25x above that. Overall-path-only: the event-study path REQUIRES never-treated units per Appendix B.2. Closes paper-review checklist L191. - fit(covariates=...) raises NotImplementedError via an explicit keyword-only param, pointing to the deferred Appendix B.1 / Theorem 6 covariate-adjusted extension, instead of a bare TypeError from an unknown kwarg. REGISTRY HeterogeneousAdoptionDiD documents both as library Notes + ticks the covariates implementation-checklist item; the new covariates param is propagated to the llms-full.txt guide signature block (pinned by tests/test_guides.py). New behavioral tests in test_had.py + deviation locks in TestHADDeviations. Retires the two TODO rows. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
deb1a74 to
b04bf2b
Compare
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment ✅ Looks good. No unmitigated P0/P1 findings. The prior P1 guide-signature issue is resolved. Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
Summary
fit()overall-path extensive-marginUserWarning(TODO L74): fires when>= 10%of units have an exactly-zero post-period dose — a genuine untreated mass for which a standard DiD may be more appropriate. Closes paper-review checklist L191.fit(covariates=...)raisesNotImplementedError(TODO L73): an explicit keyword-only param pointing to the deferred Appendix B.1 / Theorem 6 covariate-adjusted extension, instead of a bareTypeErrorfrom an unknown kwarg.Notes; new behavioral tests + deviation locks; retires the two TODO rows; CHANGELOG bullet. No change to any estimate or standard error.Methodology references (required if estimator / math changes)
HeterogeneousAdoptionDiD(de Chaisemartin, Ciccia, D'Haultfœuille & Knau 2026, arXiv:2405.04465)- **Note:**bullets in REGISTRY §HeterogeneousAdoptionDiD and locked inTestHADDeviations.Validation
tests/test_had.py(TestExtensiveMarginWarning+TestCovariatesTrap, 9 tests: fire / no-fire all-positive / just-below-10% boundary / both-aggregate trap / event-study-never-treated no-warn);tests/test_methodology_had.py::TestHADDeviations(2 deviation locks: the 10% convention incl. the pinned_HAD_EXTENSIVE_MARGIN_ZERO_DOSE_FRAC == 0.10constant, and the covariates trap). Full HAD suite: 341 passed, 2 skipped.black/ruff/mypyclean.Security / privacy
🤖 Generated with Claude Code