DiagnosticsPlots.posterior_predictive#

DiagnosticsPlots.posterior_predictive(original_scale=True, hdi_prob=0.94, idata=None, dims=None, figsize=None, backend=None, return_as_pc=False, line_kwargs=None, hdi_kwargs=None, observed_kwargs=None, **pc_kwargs)[source]#

Plot time series from the posterior predictive distribution.

Creates one panel per extra-dimension combination (e.g. one per geo for geo-segmented models). Each panel overlays the posterior mean line, an HDI band, and the observed target.

Parameters:
original_scalebool, default True

If True, plots y_original_scale from posterior_predictive and the observed target in original units. If False, plots y (internal model scale) and the observed target in the same scaled units.

hdi_probfloat, default 0.94

Probability mass of the HDI band.

idataaz.InferenceData, optional

Override instance data. Constructs a local MMMIDataWrapper for this call only — does not mutate self._data.

dimsdict[str, Any], optional

Subset dimensions, e.g. {"geo": ["CA", "NY"]}.

figsizetuple[float, float], optional

Figure size injected into figure_kwargs.

backendstr, optional

Rendering backend. Non-matplotlib backends require return_as_pc=True.

return_as_pcbool, default False

If True, return the PlotCollection instead of (Figure, NDArray[Axes]).

line_kwargsdict, optional

Forwarded to azp.visuals.line_xy for the predictive mean line.

hdi_kwargsdict, optional

Forwarded to azp.visuals.fill_between_y for the HDI band.

observed_kwargsdict, optional

Forwarded to azp.visuals.line_xy for the observed data line. Default: solid black line labelled “Observed”.

**pc_kwargs

Forwarded to PlotCollection.wrap().

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

Examples

fig, axes = mmm.plot.diagnostics.posterior_predictive()
fig, axes = mmm.plot.diagnostics.posterior_predictive(
    original_scale=False, hdi_prob=0.50, dims={"geo": ["CA"]}
)