BudgetPlots.allocation_roas#

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

Forest plot of per-channel ROAS from an optimised budget allocation.

One row per channel; x-axis is ROAS; thick bar = 50% HDI, thin bar = hdi_prob HDI; point = median; vertical reference line at x=1 marks break-even (ROAS < 1 means a money-losing channel at this allocation).

Parameters:
samplesxr.Dataset

Output of sample_response_distribution(...) or equivalent. Must contain:

  • channel_contribution_original_scale (dims: sample or (chain, draw), date, channel, …)

  • allocation (dims: channel, …)

dimsdict, optional

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

hdi_probfloat, default 0.94

Probability mass for the outer HDI bar.

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]).

**pc_kwargs

Forwarded to azp.plot_forest().

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