StaggeredDifferenceInDifferences.plot#
- StaggeredDifferenceInDifferences.plot(*, group='posterior', hdi_prob=None, figsize=(10, 6), show=True, legend_kwargs=None)[source]#
Plot the staggered difference-in-differences event study.
- Parameters:
group (
Literal['prior','posterior']) – Which draw group to plot."prior"renders a single-panel prior predictive check — the observed aggregate outcome against the prior-implied counterfactual — and requiressample_prior_predictive();"posterior"(default) renders the event study and requiresfit(). The two groups intentionally return different axes layouts.hdi_prob (
float|None) – Probability mass of the highest density interval shown by the error bars. Unlike most other CausalPy experiments,hdi_probfor staggered DiD is fixed 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".figsize (
tuple[float,float]) – Width and height of the figure in inches, passed tomatplotlib.pyplot.subplots(). Defaults to(10, 6).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]) – A single-element list containing the event-study axes.
- Return type: