BudgetPlots.contribution_over_time#

BudgetPlots.contribution_over_time(samples, dims=None, hdi_prob=0.94, figsize=None, backend=None, return_as_pc=False, line_kwargs=None, hdi_kwargs=None, **pc_kwargs)[source]#

Time-series of channel contributions from an optimised budget allocation.

Creates one panel per extra-dimension combination (e.g. one per geo). Each panel shows a mean line and HDI band per channel.

Parameters:
samplesxr.Dataset

Output of mmm.allocate_budget_to_maximize_response(...) or equivalent. Must have:

  • a variable whose name contains "channel_contribution" (dims: sample, date, channel, …)

dimsdict, optional

Dimension filters, e.g. {"geo": ["CA"]}.

hdi_probfloat, default 0.85

HDI probability mass.

figsizetuple, optional

Injected into figure_kwargs.

backendstr, optional

Rendering backend. Non-matplotlib requires return_as_pc=True.

return_as_pcbool, default False

Return the PlotCollection instead of (Figure, NDArray[Axes]).

line_kwargsdict, optional

Extra kwargs forwarded to azp.visuals.line_xy.

hdi_kwargsdict, optional

Extra kwargs forwarded to azp.visuals.fill_between_y.

**pc_kwargs

Forwarded to PlotCollection.wrap().

Returns:
tuple[Figure, NDArray[Axes]] or PlotCollection