(gallery_loo_pava)=

# LOO PAV-adjusted calibration

PAV-adjusted calibration plot using leave-one-out (LOO) cross-validation to resample
the posterior predictive distribution. Ideal for binary, ordinal or categorical data.



::::::{tab-set}
:class: full-width
:sync-group: backend

:::::{tab-item} Matplotlib
:sync: matplotlib

![Matplotlib version of plot_loo_pava](_images/plot_loo_pava.png)

:::::

:::::{tab-item} Bokeh
:sync: bokeh

```{bokeh-plot}
:source-position: none

from bokeh.plotting import show

from arviz_base import load_arviz_data

import arviz_plots as azp

azp.style.use("arviz-variat")

dt = load_arviz_data("anes")
pc = azp.plot_loo_pava(
dt,
backend="bokeh",
)


# for some reason the bokeh plot extension needs explicit use of show
show(pc.viz["figure"].item() if pc.viz["figure"].item() is not None else pc.viz["plot"].item())
```

Link to this page with the [bokeh tab selected](https://arviz-plots.readthedocs.io/en/latest//gallery/plot_loo_pava.html?backend=bokeh#synchronised-tabs)
:::::

:::::{tab-item} Plotly
:sync: plotly

```{jupyter-execute}
:hide-code:

from arviz_base import load_arviz_data

import arviz_plots as azp

azp.style.use("arviz-variat")

dt = load_arviz_data("anes")
pc = azp.plot_loo_pava(
dt,
backend="plotly",
)
pc.show()
```

Link to this page with the [plotly tab selected](https://arviz-plots.readthedocs.io/en/latest//gallery/plot_loo_pava.html?backend=plotly#synchronised-tabs)
:::::
::::::

```{literalinclude} _scripts/plot_loo_pava.py
:emphasize-lines: 10
```



:::{seealso}
API Documentation: {func}`~arviz_plots.plot_loo_pava`

EABM chapter on [Posterior predictive checks for binary data](https://arviz-devs.github.io/EABM/Chapters/Prior_posterior_predictive_checks.html#posterior-predictive-checks-for-binary-data)
:::



## Other examples with `plot_loo_pava`

```{eval-rst}
.. minigallery:: plot_loo_pava
```


:::{div} example-plot-download
{download}`Download Python Source Code: plot_loo_pava.py<_scripts/plot_loo_pava.py>`
:::
