arviz_plots.plot_dgof

Contents

arviz_plots.plot_dgof#

arviz_plots.plot_dgof(dt, *, var_names=None, filter_vars=None, group='posterior', coords=None, sample_dims=None, kind=None, envelope_prob=None, plot_collection=None, backend=None, labeller=None, aes_by_visuals=None, visuals=None, stats=None, **pc_kwargs)[source]#

Plot a Δ-ECDF-PIT diagnostic for 1D marginal distributions.

A Δ-ECDF-PIT diagnostic is plotted to assess the goodness-of-fit of the estimated distributions to the underlying data using the specified kind (kde, histogram, or quantile dot plot) [1]. If the estimated distributions are accurate, the PIT values should be uniformly distributed on [0, 1], resulting in a Δ-ECDF close to zero. Simultaneous confidence bands are computed using simulation method described in [2].

Parameters:
dtxarray.DataTree

Input data

var_namesstr or list of str, optional

One or more variables to be plotted. 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, default “posterior”

Group to be plotted.

coordsdict, optional

Coordinates to be used to index data variables.

sample_dimsstr or sequence of hashable, optional

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

kind{“kde”, “hist”, “dot”}, optional

Which method to diagnose the distribution fit. Defaults to rcParams["plot.density_kind"]

envelope_probfloat, optional

Indicates the probability that should be contained within the envelope. Defaults to rcParams["stats.envelope_prob"].

plot_collectionPlotCollection, optional
backend{“matplotlib”, “bokeh”, “plotly”}, optional
labellerlabeller, optional
aes_by_visualsmapping, 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:

statsmapping, optional

Valid keys are:

  • ecdf_pit -> passed to ecdf_pit. Default is {"n_simulations": 1000}.

**pc_kwargs

Passed to arviz_plots.PlotCollection.grid

Returns:
PlotCollection

References

[1]

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

[2]

Säilynoja et al. Graphical test for discrete uniformity and its applications in goodness-of-fit evaluation and multiple sample comparison. Statistics and Computing 32(32). (2022) https://doi.org/10.1007/s11222-022-10090-6

Examples

Δ-ECDF-PIT diagnostic for quantile dot marginals:

>>> from arviz_plots import plot_dgof, style
>>> style.use("arviz-variat")
>>> from arviz_base import load_arviz_data
>>> dt = load_arviz_data("centered_eight")
>>> plot_dgof(dt, var_names=["mu" , "tau"], kind="dot");
../../_images/arviz_plots-plot_dgof-1.png