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
Thread vcov_type through MultiPeriodDiD and TwoWayFixedEffects
CI review caught that Phase 1a wired vcov_type into DifferenceInDifferences
__init__/get_params but not into the overridden fit() paths on
MultiPeriodDiD and TwoWayFixedEffects, so `vcov_type="hc2_bm"` on either
silently produced HC1 inference. Summary output also mislabeled
wild-bootstrap inference with the analytical variance family.
- diff_diff/estimators.py MultiPeriodDiD.fit: pass vcov_type=self.vcov_type
into the analytical solve_ols call; remove the `not self.robust`
homoskedastic fallback (subsumed by compute_robust_vcov's classical
branch). When vcov_type="hc2_bm" and no survey design, compute
Bell-McCaffrey Satterthwaite DOF via _compute_bm_dof_from_contrasts for
both per-coefficient period effects AND the post-period-average
contrast; fall back to the shared analytical df otherwise. Store
vcov_type and cluster_name on MultiPeriodDiDResults.
- diff_diff/twfe.py: forward self.robust and self.vcov_type into the two
LinearRegression instantiations; store vcov_type and the TWFE auto-
cluster label (or explicit self.cluster) on DiDResults.
- diff_diff/linalg.py: split _compute_bm_dof_oneway into a contrast-aware
helper _compute_bm_dof_from_contrasts(X, bread, h_diag, contrasts) so
MultiPeriodDiD can request BM DOF for the avg_att linear combination.
The per-coefficient wrapper now delegates to the shared helper with
contrasts=I_k.
- diff_diff/results.py DiDResults.summary and MultiPeriodDiDResults:
gate the Variance family label on inference_method == "analytical" so
wild-bootstrap output is no longer mislabeled; add vcov_type,
cluster_name, inference_method, n_bootstrap, n_clusters fields to
MultiPeriodDiDResults for symmetry with DiDResults and to drive the
summary label.
- tests/test_estimators_vcov_type.py: add five end-to-end tests exercising
the previously-untested paths - MultiPeriodDiD classical vs hc1 SE
differ; MultiPeriodDiD hc2_bm CI is finite; TWFE hc1 vs hc2_bm SE differ
(CR1 vs CR2); TWFE records the unit auto-cluster label in summary;
wild-bootstrap with cluster suppresses the Variance line.
All 209 Phase 1a suites plus 145 estimator regression tests pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments