HierarchicalInterruptedTimeSeries.plot_unit#

HierarchicalInterruptedTimeSeries.plot_unit(unit_id=0)[source]#

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

Parameters:

unit_id (int) – The unit identifier (as it appears in the unit_col column of the input data) to plot.

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)