MMMPlotSuite.param_stability#

MMMPlotSuite.param_stability(results, parameter, dims=None)[source]#

Plot parameter stability across CV iterations.

Generates forest plots showing how parameter estimates vary across cross-validation folds, helping assess model stability.

Parameters:
resultsarviz.InferenceData

Combined InferenceData produced by TimeSliceCrossValidator.run(). Must contain a coordinate named ‘cv’ which labels each CV fold.

parameterlist of str

List of parameter names to plot (e.g., ["beta_channel"]).

dimsdict, optional

Dictionary specifying dimensions and coordinate values to slice over. Each key is a dimension name, and the value is a list of coordinate values. A separate forest plot is generated for each combination. Example: {"geo": ["geo_a", "geo_b"]}.

Returns:
figmatplotlib.figure.Figure

The matplotlib figure object (last one if multiple plots generated).

axmatplotlib.axes.Axes

The axes object (last one if multiple plots generated).

Raises:
TypeError

If results is not an arviz.InferenceData object.

ValueError

If the InferenceData does not contain a ‘cv’ coordinate. If unable to select specified dimensions from posterior.

See also

TimeSliceCrossValidator.run

Generate the combined InferenceData.

cv_predictions

Plot posterior predictive across folds.

cv_crps

Plot CRPS scores across folds.

Examples

Basic usage:

>>> suite = MMMPlotSuite(idata=None)
>>> fig, ax = suite.param_stability(combined_idata, parameter=["beta_channel"])

With dimension slicing:

>>> fig, ax = suite.param_stability(
...     combined_idata, parameter=["beta_channel"], dims={"geo": ["US", "UK"]}
... )