MMMPlotSuite.channel_contribution_share_hdi#

MMMPlotSuite.channel_contribution_share_hdi(hdi_prob=0.94, dims=None, figsize=(10, 6), **plot_kwargs)[source]#

Plot the share of channel contributions in a forest plot.

Shows the percentage contribution of each channel to the total response, computed from channel contributions in the original scale. Each channel’s share represents what percentage of the total response it accounts for.

Parameters:
hdi_probfloat, optional

HDI probability mass to display. Default is 0.94.

dimsdict[str, str | int | list], optional

Dimension filters to apply. Example: {“geo”: “US”}. If provided, only the selected slice(s) will be plotted.

figsizetuple[float, float], optional

Figure size. Default is (10, 6).

**plot_kwargs

Additional keyword arguments passed to az.plot_forest.

Returns:
figmatplotlib.figure.Figure

The Figure object containing the plot.

axmatplotlib.axes.Axes

The Axes object with the forest plot.

Raises:
ValueError

If channel_contribution_original_scale is not found in posterior. If no posterior data is found in idata.

Examples

Plot channel contribution shares:

fig, ax = mmm.plot.channel_contribution_share_hdi(hdi_prob=0.94)

With dimension filtering:

fig, ax = mmm.plot.channel_contribution_share_hdi(
    hdi_prob=0.90, dims={"geo": "US"}
)