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_prob
float, optional HDI probability mass to display. Default is 0.94.
- dims
dict[str,str|int|list], optional Dimension filters to apply. Example: {“geo”: “US”}. If provided, only the selected slice(s) will be plotted.
- figsize
tuple[float,float], optional Figure size. Default is (10, 6).
- **plot_kwargs
Additional keyword arguments passed to
az.plot_forest.
- hdi_prob
- Returns:
- fig
matplotlib.figure.Figure The Figure object containing the plot.
- ax
matplotlib.axes.Axes The Axes object with the forest plot.
- fig
- Raises:
ValueErrorIf
channel_contribution_original_scaleis 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"} )