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_scalefrom posterior_predictive and the observed target in original units. If False, plotsy(internal model scale) and the observed target in the same scaled units.- hdi_prob
float, default 0.94 Probability mass of the HDI band.
- idata
az.InferenceData, optional Override instance data. Constructs a local MMMIDataWrapper for this call only — does not mutate
self._data.- dims
dict[str,Any], optional Subset dimensions, e.g.
{"geo": ["CA", "NY"]}.- figsize
tuple[float,float], optional Figure size injected into
figure_kwargs.- backend
str, 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_kwargs
dict, optional Forwarded to
azp.visuals.line_xyfor the predictive mean line.- hdi_kwargs
dict, optional Forwarded to
azp.visuals.fill_between_yfor the HDI band.- observed_kwargs
dict, optional Forwarded to
azp.visuals.line_xyfor the observed data line. Default: solid black line labelled “Observed”.- **pc_kwargs
Forwarded to
PlotCollection.wrap().
- original_scalebool, default
- Returns:
tuple[Figure,NDArray[Axes]] orPlotCollection
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"]} )