arviz_plots.plot_loo_pava

Contents

arviz_plots.plot_loo_pava#

arviz_plots.plot_loo_pava(dt, *, var_names=None, filter_vars=None, group='posterior_predictive', coords=None, sample_dims=None, data_type='binary', ci_prob=None, plot_collection=None, backend=None, labeller=None, aes_by_visuals=None, visuals=None, **pc_kwargs)[source]#

LOO PAV-adjusted calibration plot.

Uses PSIS-LOO-CV to resample the posterior predictive distribution, then applies the pool adjacent violators (PAV) algorithm for isotonic regression. A 45-degree line corresponds to perfect calibration. Details on the PAV-adjusted calibration plot are discussed in [1] and [2], and PSIS-LOO-CV in [3] and [4].

Parameters:
dtxarray.DataTree

Input data. It should contain the posterior, posterior_predictive, log_likelihood and observed_data groups.

var_namesstr or list of str, optional

One or more variables to be plotted. Currently only one variable is supported. Prefix the variables by ~ when you want to exclude them from the plot.

filter_vars{None, “like”, “regex”}, optional, default=None

If None (default), interpret var_names as the real variables names. If “like”, interpret var_names as substrings of the real variables names. If “regex”, interpret var_names as regular expressions on the real variables names.

groupstr, optional

Only “posterior_predictive” is supported.

coordsdict, optional

Coordinates to plot. CURRENTLY NOT IMPLEMENTED

sample_dimsstr or sequence of hashable, optional

Dimensions to reduce unless mapped to an aesthetic. Defaults to rcParams["data.sample_dims"]

data_typestr

Defaults to “binary”. Other options are “categorical” and “ordinal”. If “categorical”, the plot will show the “one-vs-others” calibration and generate one plot per category. If “ordinal”, the plot will display cumulative conditional event probabilities and generate (number of categories - 1) plots.

ci_probfloat, optional

Probability for the credible interval. Defaults to rcParams["stats.ci_prob"].

plot_collectionPlotCollection, optional
backend{“matplotlib”, “bokeh”, “plotly”}, optional
labellerlabeller, optional
aes_by_visualsmapping of {strsequence of str}, optional

Mapping of visuals to aesthetics that should use their mapping in plot_collection when plotted. Valid keys are the same as for visuals.

visualsmapping of {strmapping or bool}, optional

Valid keys are:

markers defaults to False, no markers are plotted. Pass an (empty) mapping to plot markers.

**pc_kwargs

Passed to arviz_plots.PlotCollection.grid

Returns:
PlotCollection

See also

plot_ppc_pava

PAV-adjusted calibration plot using posterior predictive.

References

[1]

Säilynoja et al. Recommendations for visual predictive checks in Bayesian workflow. (2025) arXiv preprint https://arxiv.org/abs/2503.01509

[2]

Dimitriadis et al Stable reliability diagrams for probabilistic classifiers. PNAS, 118(8) (2021). https://doi.org/10.1073/pnas.2016191118

[3]

Vehtari et al. Practical Bayesian model evaluation using leave-one-out cross-validation and WAIC. Statistics and Computing. 27(5) (2017) https://doi.org/10.1007/s11222-016-9696-4

[4]

Vehtari et al. Pareto Smoothed Importance Sampling. Journal of Machine Learning Research, 25(72) (2024) https://jmlr.org/papers/v25/19-556.html

Examples

Plot the LOO PAVA calibration plot for the anes dataset.

>>> from arviz_plots import plot_loo_pava, style
>>> style.use("arviz-variat")
>>> from arviz_base import load_arviz_data
>>> dt = load_arviz_data('anes')
>>> plot_loo_pava(dt, ci_prob=0.90)
../../_images/arviz_plots-plot_loo_pava-1.png