Commit 31d68e8
Fix post-consolidation P1: event-study plot uses survey-aware CIs
The §5 matplotlib event-study plot hard-coded `yerr=1.96 * es.se`
(Normal-theory pointwise CI) but the table immediately above
uses `es.conf_int_low/high`, which the estimator computes with
`t` critical values and `df_survey` on the survey path
(`diff_diff/had.py:4352-4445`, `diff_diff/utils.py:38-46,177-210`).
The plot silently understated uncertainty and contradicted its
own neighboring table — a real methodology bug, not just prose.
The cband ribbon was already drawn from `es.cband_low/high`
(unaffected); only the pointwise error bars were broken.
Fix:
- Plot now builds asymmetric `yerr` from the stored
`es.conf_int_low/high`. matplotlib's `errorbar` accepts a (2, n)
array of `[lower_distances, upper_distances]`, which is what
the estimator's stored endpoints encode (no need to back out
the implied t critical value manually).
- Legend label changed from "point + pointwise CI" to
"point + pointwise CI (survey-aware t)" to flag the
inference family in the figure.
Drift coverage:
- New `test_event_study_plot_uses_stored_pointwise_ci_endpoints`
inspects the notebook source and rejects both the
`1.96 * np.asarray(es.se)` and `1.96 * es.se` patterns, AND
requires that the plot cell references `conf_int_low` /
`conf_int_high`. This is a source-level static check (the plot
cell has no return value to introspect at runtime), but it
catches exactly this class of regression. Brings the drift
suite from 31 to 32 tests; CHANGELOG / REGISTRY counts
updated.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 57753ee commit 31d68e8
4 files changed
Lines changed: 46 additions & 3 deletions
File tree
- docs
- methodology
- tutorials
- tests
0 commit comments