SyntheticDifferenceInDifferences.plot#
- SyntheticDifferenceInDifferences.plot(*, round_to=None, ci_prob=0.94, hdi_prob=None, kind='ribbon', ci_kind='hdi', num_samples=50, figsize=(7, 11), show=True, legend_kwargs=None)[source]#
Plot SDiD results: counterfactual, period impact, and cumulative impact.
- Parameters:
round_to (
int|None) – Number of decimals used to round the ATT in the title. Defaults to 2. UseNonefor raw values.ci_prob (
float) – Probability mass of the highest density interval drawn around the posterior predictive, causal impact, and cumulative impact bands. Must be in(0, 1]. Defaults toHDI_PROB(currently 0.94).kind (
Literal['ribbon','histogram','spaghetti']) – How posterior uncertainty is rendered. Defaults to"ribbon"(mean + credible band).ci_kind (
Literal['hdi','eti']) – Credible interval type whenkind="ribbon". Defaults to"hdi".num_samples (
int) – Number of posterior draws to overlay whenkind="spaghetti". Defaults to 50.figsize (
tuple[float,float]) – Width and height of the figure in inches. Defaults to(7, 11)so the three panels and date tick labels have room.show (
bool) – Whether to callmatplotlib.pyplot.show()after drawing. Defaults toTrue.legend_kwargs (
dict[str,Any] |None) – Keyword arguments applied to the top-axis legend in place after the figure is built. Supported keys includeloc,bbox_to_anchor,fontsize,frameon,title, and optionallybbox_transformalongsidebbox_to_anchor. See_render_plot().
- Returns:
fig (matplotlib.figure.Figure) – The figure containing the three stacked panels (plotnine base plus matplotlib overlays for the treatment line and date formatting).
ax (numpy.ndarray) – Array of the three
matplotlib.axes.Axesinstances.
- Return type: