Add DurationDiD for absorbing individual outcomes - #826
Conversation
Overall assessment: ✅ Looks goodExecutive summary
Methodology
No undocumented methodology mismatch, missing assumption guard, or incorrect SE/variance calculation found. Code Quality
PerformanceNo findings. MaintainabilityNo findings. Constructor parameters propagate through results, bootstrap, aggregation, serialization, and reporting. Tech Debt
SecurityNo findings or exposed secrets identified. Documentation/TestsNo findings. The PR includes methodology tests, edge-case coverage, reporting/serialization tests, an executed tutorial, and Test execution was unavailable in this review environment because its Python test dependencies are not installed. |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall assessment: ✅ Looks goodExecutive summary
Methodology
No undocumented mismatch, missing assumption guard, or incorrect variance/SE calculation found. Code Quality
PerformanceNo findings. MaintainabilityNo findings. Constructor configuration propagates through fitting, bootstrap inference, results, aggregation, serialization, and reporting. Tech Debt
SecurityNo findings or exposed secrets identified in the changed feature files. Documentation/TestsNo findings. The PR includes the required changelog fragment at Tests could not be executed in this review environment because |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall assessment: ✅ Looks goodExecutive summary
Methodology
No incorrect estimator formula, variance/SE calculation, control composition, or missing assumption guard found. Code Quality
PerformanceNo findings. The MaintainabilityNo findings. All constructor parameters propagate through fitting, inference, results, serialization, aggregation, and reporting. Tech Debt
SecurityNo findings or exposed secrets identified in the changed files. Documentation/TestsNo findings. The required fragment exists at Runtime tests could not execute because NumPy, pandas, SciPy, and pytest are unavailable; all 20 changed Python files and the notebook JSON parsed successfully. |
Adds
DurationDiDfor absorbing binary outcomes in complete individual panels with two groups and common treatment timing. It estimates cumulative absorption effects under common-dynamics or proportional untreated-hazard restrictions. The headline uniformly averages declared post-period ATTs over the whole treated population, including individuals already absorbed at baseline; positive effects mean increased absorption.Includes configurable pre-period calibration, pooled individual-bootstrap pointwise and simultaneous inference,
DurationDiDResults, and the storedDurationDiDPretestResultshazard diagnostic. Results support simple/event-study aggregation and owned, JSON-safe exports. All four constructor parameters are validated on construction, throughset_params()and before every fit. Invalid direct updates raise a parameter-specific error and preserve any previous fitted result; valid updates apply on the next fit. Summaries print distinct inference-unavailability reasons once while retaining the full per-family metadata. DiagnosticReport and BusinessReport show the stored hazard verdict, fitted confidence level and availability reasons. BusinessReport validates supplied native diagnostics. API documentation, packaged guides and an executed tutorial accompany the estimator.Methodology references (required if estimator / math changes)
method="common_dynamics"ormethod="proportional_hazards".docs/methodology/REGISTRY.mdunder DurationDiD.Material limitations
Validation
docs/tutorials/33_duration_did.ipynbexecuted successfully; subsequent validation passed without modifying the saved notebook. Its six executed code cells and two saved plots were inspected. Synthetic examples exercise both hazard methods.mypy --python-version 3.12 diff_diff: passed, 110 source files. Local default configured mypy was blocked by installed NumPy stubs using Python 3.12 type syntax while the configuration targets Python 3.10; project dependency constraints and type-check configuration are unchanged.Security / privacy
Changelog
changelog.d/20260906-duration-did.md.