HierarchicalInterruptedTimeSeries.plot_unit#

HierarchicalInterruptedTimeSeries.plot_unit(unit_id=0, *, ci_prob=0.94)[source]#

Plot observed vs counterfactual and causal impact for a single unit.

Parameters:
  • unit_id (Any) – The unit identifier (as it appears in the unit_col column of the input data) to plot. Matched by equality, so any dtype present in unit_col works.

  • ci_prob (float) – Probability mass of the HDI band drawn around the posterior causal impact. Must be in (0, 1]. Defaults to HDI_PROB.

Returns:

Matplotlib figure and axes. Top panel shows observed data, fitted mean (with effect) and counterfactual mean (without effect). Bottom panel shows the posterior causal impact with HDI.

Return type:

fig, (ax1, ax2)