|
42 | 42 | #' PITs to the standard uniform distribution. Comparing to the uniform is not
|
43 | 43 | #' good for extreme probabilities close to 0 and 1, so it can sometimes be
|
44 | 44 | #' useful to set the `compare` argument to `"normal"`, which will
|
45 |
| -#' produce a Q-Q plot comparing standardized PIT values to the standard normal |
46 |
| -#' distribution that can help see the (mis)calibration better for the extreme |
47 |
| -#' values. However, in most cases we have found that the overlaid density plot |
48 |
| -#' (`ppc_loo_pit_overlay()`) function will provided a clearer picture of |
49 |
| -#' calibration problems that the Q-Q plot. |
| 45 | +#' produce a Q-Q plot comparing standard normal quantiles calculated from the |
| 46 | +#' PIT values to the theoretical standard normal quantiles. This can help see |
| 47 | +#' the (mis)calibration better for the extreme values. However, in most cases |
| 48 | +#' we have found that the overlaid density plot (`ppc_loo_pit_overlay()`) |
| 49 | +#' function will provide a clearer picture of calibration problems than the |
| 50 | +#' Q-Q plot. |
50 | 51 | #' }
|
51 | 52 | #' \item{`ppc_loo_intervals()`, `ppc_loo_ribbon()`}{
|
52 | 53 | #' Similar to [ppc_intervals()] and [ppc_ribbon()] but the intervals are for
|
|
113 | 114 | #' @param compare For `ppc_loo_pit_qq()`, a string that can be either
|
114 | 115 | #' `"uniform"` or `"normal"`. If `"uniform"` (the default) the Q-Q plot
|
115 | 116 | #' compares computed PIT values to the standard uniform distribution. If
|
116 |
| -#' `compare="normal"`, the Q-Q plot compares standardized PIT values to the |
117 |
| -#' standard normal distribution. |
| 117 | +#' `compare="normal"`, the Q-Q plot compares standard normal quantiles |
| 118 | +#' calculated from the PIT values to the theoretical standard normal |
| 119 | +#' quantiles. |
118 | 120 | #' @param trim Passed to [ggplot2::stat_density()].
|
119 | 121 | #' @template args-density-controls
|
120 | 122 | ppc_loo_pit_overlay <- function(y,
|
@@ -220,10 +222,10 @@ ppc_loo_pit_qq <- function(y,
|
220 | 222 | x_lab <- "Uniform"
|
221 | 223 | y_lab <- "LOO-PIT"
|
222 | 224 | } else {
|
223 |
| - pit <- as.vector(scale(pit)) |
| 225 | + pit <- as.vector(stats::qnorm(pit)) |
224 | 226 | theoretical <- stats::qnorm
|
225 | 227 | x_lab <- "Normal"
|
226 |
| - y_lab <- "LOO-PIT (standardized)" |
| 228 | + y_lab <- "LOO-PIT (standard normal quantiles)" |
227 | 229 | }
|
228 | 230 |
|
229 | 231 | ggplot(data.frame(p = pit)) +
|
|
0 commit comments