diff_diff.plot_honest_event_study#
- diff_diff.plot_honest_event_study(honest_results, *, periods=None, reference_period=None, figsize=(10, 6), title='Event Study with Honest Confidence Intervals', xlabel='Period Relative to Treatment', ylabel='Treatment Effect', original_color='#6b7280', honest_color='#2563eb', marker='o', markersize=8, capsize=4, ax=None, show=True, backend='matplotlib')[source]
Create event study plot with Honest DiD confidence intervals.
Shows both the original confidence intervals (assuming parallel trends) and the robust confidence intervals that allow for bounded violations.
- Parameters:
honest_results (HonestDiDResults) – Results from HonestDiD.fit() that include event_study_bounds.
periods (list, optional) – Periods to plot. If None, uses all available periods.
reference_period (any, optional) – Reference period to show as hollow marker.
figsize (tuple, default=(10, 6)) – Figure size.
title (str) – Plot title.
xlabel (str) – X-axis label.
ylabel (str) – Y-axis label.
original_color (str) – Color for original (standard) confidence intervals.
honest_color (str) – Color for honest (robust) confidence intervals.
marker (str) – Marker style.
markersize (int) – Marker size.
capsize (int) – Error bar cap size.
ax (matplotlib.axes.Axes, optional) – Axes to plot on.
show (bool, default=True) – Whether to call plt.show().
backend (str, default="matplotlib") – Plotting backend:
"matplotlib"or"plotly".
- Returns:
The axes object (matplotlib) or figure (plotly).
- Return type:
matplotlib.axes.Axes or plotly.graph_objects.Figure
Notes
This function requires the HonestDiDResults to have been computed with event_study_bounds. If only a scalar bound was computed, use plot_sensitivity() instead.