You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: vignettes/loo-pit-correlated-tests.Rmd
+45-69Lines changed: 45 additions & 69 deletions
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,7 @@ bayesplot_theme_set()
28
28
set.seed(2026)
29
29
```
30
30
31
+
## Setup
31
32
```{r, eval=FALSE}
32
33
library(bayesplot)
33
34
library(ggplot2)
@@ -49,23 +50,6 @@ Following the work of Tesso & Vehtari ([2026](#Tesso2026)), `bayesplot` now offe
49
50
50
51
This vignette focuses specifically on the changes introduced by this new correlation-aware method. For background information on graphical uniformity tests using PIT, see Säilynoja et al. ([2022](#Säilynoja2022)). For a more general discussion on the use of Leave-One-Out Cross-Validation (LOO-CV), see Vehtari et al. ([2017](#Vehtari2017), [2024](#Vehtari2024)), among others.
51
52
52
-
## The `method` argument
53
-
### `method = "independent"` (superseded)
54
-
When `method = "independent"` is selected, simultaneous confidence bands for the ECDF are constructed under the assumption that the PIT values are both independent and uniform (Säilynoja et al., [2022](#Säilynoja2022)). However, if this independence assumption is violated, the resulting bands can be too wide, which reduces the test's sensitivity to actual miscalibration (Tesso & Vehtari, [2026](#Tesso2026)).
55
-
56
-
**Deprecation and Compatibility**
57
-
58
-
As of `bayesplot vX.X.X`, the `"independent"` method is officially superseded. To maintain backward compatibility, `"independent"` remains the current default; however, using it will now trigger a message informing the user:
59
-
```
60
-
"The 'independent' method is superseded by the 'correlated' method."
61
-
```
62
-
This is intended to encourage a transition to the `"correlated"` method, which will become the default in a future release.
63
-
64
-
### `method = "correlated"` (new, recommended)
65
-
This method employes one of three dependence-aware uniformity tests (selected via the `test` argument) to compute a global p-value for the null hypothesis of uniformity. Unlike the independent method, it accounts for the correlation among PIT values (Tesso & Vehtari, [2026](#Tesso2026)).
66
-
67
-
Instead of drawing traditional confidence bands, the plot highlights ECDF regions in red where the pointwise contribution to the test statistic is largest. This visualization makes it easier to diagnose the *type* and *location* of miscalibration.
68
-
69
53
## Reading the plots for different (mis)calibration scenarios
70
54
The shape of the ECDF curve provides direct insight into *how* a predictive distribution is miscalibrated. To illustrate this, the following examples utilize simulated scenarios where "observed" values (`y`) are drawn from a `normal(0, sd)` distribution, while "replicated" values (`yrep`) are generated from a non-central t-distribution. By varying the degrees of freedom (`df`) and non-centrality parameter (`ncp`), we can simulate and visualize several distinct types of miscalibration.
When `method = "independent"` is selected, simultaneous confidence bands for the ECDF are constructed under the assumption that the PIT values are both independent and uniform (Säilynoja et al., [2022](#Säilynoja2022)). However, if this independence assumption is violated, the resulting bands can be too wide, which reduces the test's sensitivity to actual miscalibration (Tesso & Vehtari, [2026](#Tesso2026)).
164
+
165
+
**Deprecation and Compatibility**
166
+
167
+
As of `bayesplot vX.X.X`, the `"independent"` method is officially superseded. To maintain backward compatibility, `"independent"` remains the current default; however, using it will now trigger a message informing the user:
168
+
```
169
+
"The 'independent' method is superseded by the 'correlated' method."
170
+
```
171
+
This is intended to encourage a transition to the `"correlated"` method, which will become the default in a future release.
172
+
173
+
### `method = "correlated"` (new, recommended)
174
+
This method employes one of three dependence-aware uniformity tests (selected via the `test` argument) to compute a global p-value for the null hypothesis of uniformity. Unlike the independent method, it accounts for the correlation among PIT values (Tesso & Vehtari, [2026](#Tesso2026)).
175
+
176
+
Instead of drawing traditional confidence bands, the plot highlights ECDF regions in red where the pointwise contribution to the test statistic is largest. This visualization makes it easier to diagnose the *type* and *location* of miscalibration.
It is also possible to use `brms::pp_check()` with `type = "loo_pit_ecdf"` to perform the same testing and plotting procedure as `ppc_loo_pit_ecdf()`. The following example demonstrates this using the same fitted model as above with `method = "correlated"`.
brms::pp_check(fit_normal, method = "independent", type = "pit_ecdf")
325
-
```
326
-
327
303
## Additional arguments
328
304
With the introduction of the `method = "correlated"` option, the three functions now have additional arguments that control the appearance and behavior of the plot when using correlated testing procedures. These arguments are:
0 commit comments