(gallery_ppc_pava_residuals)=

# PAV-adjusted residual plot

Residual plot using PAV-adjusted calibration for binary predictions.



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

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

![Matplotlib version of plot_ppc_pava_residuals](_images/plot_ppc_pava_residuals.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("roaches_zinb")
pc = azp.plot_ppc_pava_residuals(
dt,
var_names="y_pos",
x_var="roach count",
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_ppc_pava_residuals.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("roaches_zinb")
pc = azp.plot_ppc_pava_residuals(
dt,
var_names="y_pos",
x_var="roach count",
backend="plotly",
)
pc.show()
```

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

```{literalinclude} _scripts/plot_ppc_pava_residuals.py
:emphasize-lines: 12
```



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

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_ppc_pava_residuals`

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


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