moderndid.plots.plot_event_study#

moderndid.plots.plot_event_study(result: AGGTEResult | PTEResult | DDDAggResult, show_ci: bool = True, ref_line: float | None = 0, ref_period: float | None = -1, xlab: str | None = None, ylab: str | None = None, title: str | None = None, **_kwargs: Any) ggplot[source]#

Create event study plot for dynamic treatment effects.

Parameters:
resultAGGTEResult, PTEResult, or DDDAggResult

Aggregated treatment effect result with dynamic/eventstudy aggregation, or PTEResult with event_study attribute.

show_cibool, default=True

Whether to show confidence intervals as error bars.

ref_linefloat or None, default=0

Y-value for reference line. Set to None to hide.

ref_periodfloat or None, default=-1

X-value for vertical reference period line. Set to None to hide.

xlabstr, optional

X-axis label. Defaults to “Event Time”.

ylabstr, optional

Y-axis label. Defaults to “ATT”.

titlestr, optional

Plot title. Defaults based on result type.

Returns:
plotnine.ggplot

A plotnine ggplot object that can be further customized.