MMMPlotlyFactory.posterior_predictive#

MMMPlotlyFactory.posterior_predictive(hdi_prob=0.94, hdi_opacity=0.2, frequency=None, auto_facet=True, single_dim_facet='row', **plotly_kwargs)[source]#

Plot posterior predictive with HDI band.

Creates an interactive Plotly line chart showing model predictions vs observations, with optional HDI uncertainty band and faceting for multi-dimensional models.

Parameters:
hdi_probfloat, optional

HDI probability for uncertainty band (default: 0.94). If None, no band.

hdi_opacityfloat, default 0.2

Opacity for HDI band fill (0-1).

frequencystr, optional

Time aggregation (e.g., “monthly”, “weekly”). None = no aggregation.

auto_facetbool, default True

Automatically detect and apply faceting for custom dimensions.

single_dim_facet{“col”, “row”}, default “row”

When auto_facet is enabled and there is exactly one custom dimension, this controls whether it is applied as facet_col or facet_row.

**plotly_kwargs

Additional Plotly Express arguments including: - title: Figure title (default: “Posterior Predictive”) - facet_row: Column for row facets (e.g., “country”) - facet_col: Column for column facets (e.g., “region”) - facet_col_wrap: Max columns before wrapping

Returns:
go.Figure

Interactive Plotly figure

Examples

>>> # Basic posterior predictive plot
>>> fig = mmm.plot_interactive.posterior_predictive()
>>> fig.show()
>>> # With faceting by country
>>> fig = mmm.plot_interactive.posterior_predictive(
...     facet_col="country", facet_col_wrap=3
... )
>>> fig.show()
>>> # Without HDI band
>>> fig = mmm.plot_interactive.posterior_predictive(hdi_prob=None)
>>> fig.show()