arviz_plots.plot_ppc_dist_pit

arviz_plots.plot_ppc_dist_pit#

arviz_plots.plot_ppc_dist_pit(dt, *, var_names=None, filter_vars=None, group='posterior_predictive', coords=None, sample_dims=None, kind=None, num_samples=50, method='pot_c', envelope_prob=None, coverage=False, plot_collection=None, backend=None, labeller=None, aes_by_visuals=None, visuals=None, stats=None, **pc_kwargs)[source]#

1D marginals for the predictive distribution and PIT Δ-ECDF.

The left column shows 1D marginals for the posterior predictive distribution overlaid on the observed data, identical to plot_ppc_dist.

The right column shows the empirical CDF (ECDF) of the PIT values minus the expected CDF, identical to plot_ppc_pit.

Suspicious observations are computed from the uniformity test and they are highlighted in both columns, either as rug marks at y=0 in the dist column or as points in ECDF for the PIT column. The suspicious observations are the ones that contribute the most to deviations from uniformity.

Parameters:
dtxarray.DataTree

Input data with posterior_predictive and observed_data groups.

var_namesstr or list of str, optional

Variables to plot.

filter_vars{None, “like”, “regex”}, optional
groupstr,

Group to be plotted. Defaults to “posterior_predictive”. It could also be “prior_predictive”.

coordsdict, optional
sample_dimsstr or sequence of hashable, optional

Defaults to rcParams["data.sample_dims"].

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

Density kind for the dist column. Defaults to rcParams["plot.density_kind"].

num_samplesint, default 50

Number of predictive draws to overlay in the dist column.

method{“pot_c”, “prit_c”, “piet_c”, “envelope”}, default “pot_c”

Uniformity-test method for the PIT column.

envelope_probfloat, optional

Probability inside the simultaneous envelope. Defaults to rcParams["stats.envelope_prob"].

coveragebool, default False

If True, replace PIT with 2|PIT - 0.5| to assess ETI coverage.

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

Valid keys: predictive_dist, observed_dist, ecdf_lines, credible_interval, suspicious_points, p_value_text, title.

visualsmapping, optional

Valid keys:

  • predictive_dist -> density lines for predictive draws

  • observed_dist -> density line for observed data

  • ecdf_lines -> passed to ecdf_line

  • credible_interval -> only when method="envelope"

  • suspicious_points -> passed to scatter_xy

  • p_value_text -> passed to annotate_xy

  • xlabel_dist -> x-axis label for the dist column

  • xlabel_pit -> x-axis label for the PIT column

  • ylabel -> y-axis label for the PIT column

  • title -> passed to labelled_title

  • remove_axis -> set to False to skip axis removal

statsmapping, optional

Valid keys: predictive_dist, observed_dist, ecdf_pit.

**pc_kwargs

Passed to grid.

Returns:
PlotCollection

See also

plot_ppc_dist

Predictive density check only.

plot_ppc_pit

PIT Δ-ECDF check only.

Examples

>>> from arviz_plots import plot_ppc_dist_pit, style
>>> style.use("arviz-variat")
>>> from arviz_base import load_arviz_data
>>> dt = load_arviz_data('radon')
>>> plot_ppc_dist_pit(dt)
../../_images/arviz_plots-plot_ppc_dist_pit-1.png