feat(duration-did): add DurationDiD estimator (Deaner & Ku 2026 causal duration DiD) - #827
Conversation
Overall Assessment⛔ Blocker — one unmitigated P0 finding. Executive Summary
MethodologyP0 — Invalid mutated configuration can silently select PH
P3 — Documented methodology choices
Code QualityNo additional findings. Final inference correctly uses PerformanceNo material findings. MaintainabilityNo additional findings beyond the missing centralized fit-time configuration revalidation. Tech DebtP3 — Tracked limitations
SecurityNo findings. Documentation/TestsP0 — Missing regression coverage for the blocker
P3 — Tutorial deferred
Path to Approval
|
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment✅ Looks good — no unmitigated P0 or P1 findings. Executive Summary
MethodologyResolved — Prior configuration-validation blocker
P3 — Documented methodology choices
Code QualityNo findings. Inference uses the shared safe-inference gates and invalid methods fail closed. PerformanceNo material findings. MaintainabilityNo findings. Parameter validation and numerical routines are centralized. Tech DebtP3 — Tracked limitations
SecurityNo findings or apparent secrets. Documentation/TestsNo findings. The user-visible feature has Review-environment note: runtime tests could not be executed because |
8fca5c1 to
d7f5c7f
Compare
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall AssessmentExecutive Summary
MethodologyP3 — Documented implementation choices
Code QualityP1 [Newly identified] — Unused categorical unit levels trigger a false balance error
The prior P0 is resolved by fit-start validation at PerformanceNo findings. MaintainabilityNo findings. Tech DebtP3 — Tracked limitations
SecurityNo findings or apparent secrets. Documentation/TestsNo additional findings. The feature has Path to Approval
|
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment✅ Looks good — no unmitigated P0 or P1 findings. Executive Summary
MethodologyP3 — Documented implementation choices
Code QualityNo findings. The previous false balance error is fixed at PerformanceNo findings. MaintainabilityNo findings. Tech DebtP3 — Deferred work is tracked
SecurityNo findings or apparent secrets. Documentation/TestsNo findings. The user-visible feature has |
Summary
Adds
DurationDiDfor the Deaner & Ku (2026) two-group, common-timing design with a binary absorbing outcome, such as a spell that ends and stays ended. The methodology foundation isdocs/methodology/papers/deaner-ku-2026-review.md(#822).method="cd"fits a constant additive gap between untreated hazards;method="ph"fits a constant ratio. The estimator imputes treated counterfactual survival and reports absorption ATT by post-treatment date, with the uniform post-date average asatt.fit(pre_periods=..., pre_period_weights=...)selects fitting dates and finite, real, nonnegative weights. The default uses equal weights over eligible pre-treatment dates after the baseline. Configuration is validated again at fit start, including direct attribute mutations.results.pretestimplements the separate fixed-anchor pre-treatment specification test. Invalid counterfactual curves, failed draws or unusable standard errors (including exactly constant bootstrap statistics) withhold the affected inference family and report its status.BaseEstimator,BaseResults,summary(),to_dict(),to_dataframe()andaggregate("event_study"). Practitioner guidance explains the hazard restriction and provides an anticipation placebo with an exact preceding anchor.Methodology references (required if estimator / math changes)
DurationDiDsection ofdocs/methodology/REGISTRY.md: the mean-of-ratios PH coefficient supported by Theorem 1 and the authors' code; equal default fitting weights with optional dates/weights; the fixed-anchor pretest; whole-path curve validity; complete-draw failure policies; empirical centered-bootstrap band decisions; and the equally spaced numeric-clock restriction. The printed Equation 3.5 gives the reciprocal under exact PH, so it is not used as written.Validation
longdoubleprecision than this macOS platform provides; representable-longdouble serialization and guidance tests ran on both backends.Tests cover paper identities, hand-calculated CD/PH examples, seeded bootstrap covariance and bands, constant-draw withholding with independent family gates, preservation of small nonzero variation, Monte Carlo coverage, parameter mutation, input validation, full-inference invariance under large date translations, exact selectors, tolerance boundaries, JSON, warnings, practitioner code and reporting contracts. The coverage test uses 200 simulated datasets on both backends with the same seeds and acceptance tolerance.
The original five-grid reproduction accepts all three valid grids with identical ATT and SE and rejects both irregular grids. Both self-contained API examples execute successfully. The documentation build also verifies literal statistical notation and unambiguous parameter descriptions.
Security / privacy
Synthetic test data only; no secrets or personal data added.
Changelog
changelog.d/20260906-duration-did.mdLimitations
This initial API requires a balanced panel, common treatment timing, real binary absorbing outcomes and an equally spaced real numeric clock. Covariates, staggered adoption, censoring, survey weights, cluster dependence and repeated cross-sections are outside its scope. Floating dates must be losslessly representable as float64, and elapsed offsets must remain finite and strictly increasing; precision already lost by callers cannot be reconstructed.
DiagnosticReportandBusinessReportadmission and a tutorial notebook are tracked inTODO.md; the API page provides executable examples. Numerical validation uses the paper, hand calculations and synthetic DGPs; reference-software numerical parity remains unverified.