StaggeredDifferenceInDifferences.plot#

StaggeredDifferenceInDifferences.plot(*, hdi_prob=None, figsize=(10, 6), show=True, legend_kwargs=None)[source]#

Plot the staggered difference-in-differences event study.

Parameters:
  • hdi_prob (float | None) – Probability mass of the highest density interval shown by the error bars. Unlike most other CausalPy experiments, hdi_prob for staggered DiD is fixed at fit time during effect aggregation and the resulting bounds are cached on the instance. If supplied here, the value must match the cached hdi_prob_; otherwise a ValueError is raised. Pass None (the default) to plot using the cached value. Ignored for OLS models.

  • figsize (tuple[float, float]) – Width and height of the figure in inches, passed to matplotlib.pyplot.subplots(). Defaults to (10, 6).

  • show (bool) – Whether to automatically display the plot. Defaults to True.

  • legend_kwargs (dict[str, Any] | None) – Keyword arguments to adjust legend placement and styling. Supported keys: loc, bbox_to_anchor, fontsize, frameon, title (bbox_transform is accepted alongside bbox_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:

tuple[Figure, list[Axes]]