diff_diff.compute_honest_did#

diff_diff.compute_honest_did(results, method='relative_magnitude', M=1.0, alpha=0.05, l_vec=None)[source]

Convenience function for computing Honest DiD bounds.

Parameters:
  • results (MultiPeriodDiDResults, CallawaySantAnnaResults, or ChaisemartinDHaultfoeuilleResults) – Results from event study estimation.

  • method (str) – Type of restriction (“smoothness”, “relative_magnitude”, “combined”).

  • M (float) – Restriction parameter.

  • alpha (float) – Significance level.

  • l_vec (np.ndarray, optional) – Weight vector defining the scalar target theta = l_vec' tau over post-treatment horizons. Length must equal the number of post-treatment periods. None (default) uses equal weights (uniform average). To target the on-impact effect only (R’s default), pass np.array([1, 0, ..., 0]).

Returns:

Bounds and robust confidence intervals.

Return type:

HonestDiDResults

Examples

>>> bounds = compute_honest_did(event_study_results, method='relative_magnitude', M=1.0)
>>> print(f"Robust CI: [{bounds.ci_lb:.3f}, {bounds.ci_ub:.3f}]")