StaggeredDifferenceInDifferences.plot_group_time#
- StaggeredDifferenceInDifferences.plot_group_time(*, group='posterior', hdi_prob=None, layout='facet', x_axis='event_time', include_placebo=True, figsize=None, show=True, legend_kwargs=None)[source]#
Plot cohort-specific
ATT(g, t)trajectories.- Parameters:
group (
Literal['prior','posterior']) – Which draw group to plot."prior"renders a single-panel prior predictive check and requiressample_prior_predictive();"posterior"(default) renders the cohort trajectories and requiresfit().hdi_prob (
float|None) – Probability mass of the highest density interval shown by the uncertainty bands. As withplot(), BayesianATT(g, t)bounds are computed during effect aggregation and stored on the result bundle. If supplied here, the value must matchresult.hdi_prob; otherwise aValueErroris raised. PassNone(the default) to plot using the stored value. Ignored for OLS models and forgroup="prior".layout (
Literal['facet','overlay']) – Plot layout."facet"draws one row per cohort and"overlay"draws all cohorts on a single axes. Defaults to"facet".x_axis (
Literal['event_time','calendar_time']) – Time scale for the cohort trajectories."event_time"plots each cohort against periods since treatment, giving anATT(g, e)view derived fromATT(g, t)."calendar_time"plots each cohort against calendar timet. Defaults to"event_time".include_placebo (
bool) – Whether to include pre-treatment residual estimates for eventually-treated cohorts as placebo diagnostics. Defaults toTrue.figsize (
tuple[float,float] |None) – Width and height of the figure in inches, passed tomatplotlib.pyplot.subplots(). Defaults to a height scaled by the number of cohorts whenlayout="facet"and(10, 6)whenlayout="overlay".show (
bool) – Whether to automatically display the plot. Defaults toTrue.legend_kwargs (
dict[str,Any] |None) – Keyword arguments to adjust legend placement and styling. Supported keys:loc,bbox_to_anchor,fontsize,frameon,title(bbox_transformis accepted alongsidebbox_to_anchor). The existing legend is modified in place so that custom handles are preserved.
- Returns:
fig (matplotlib.figure.Figure) – The figure that was created.
ax (list[matplotlib.axes.Axes]) – Axes containing the cohort trajectories. The list has one axes per cohort when
layout="facet"and one axes whenlayout="overlay".
- Return type: