Skip to content

Commit b0b6ef8

Browse files
committed
drop k_diff
1 parent 57150b7 commit b0b6ef8

1 file changed

Lines changed: 8 additions & 23 deletions

File tree

R/loo_compare.R

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,17 @@
4949
#'
5050
#' * `N < 100` (small data)
5151
#' * `|elpd_diff| < 4` (models make similar predictions)
52-
#' * `k_diff > 0.5` (possible outliers)
5352
#'
54-
#' If any of these diagnostic messages is shown, the error distribution is
53+
#' If either of these diagnostic messages is shown, the error distribution is
5554
#' skewed or thick tailed and the normal approximation based on `elpd_diff`
5655
#' and `se_diff` is not well calibrated. In that case, the probabilities
57-
#' `p_worse` are likely to be too large (small data or similar predictions) or
58-
#' too small (outliers). However, `elpd_diff` and `se_diff` will still be
59-
#' indicative of the differences and uncertainties (for example, if
60-
#' `|elpd_diff|` is many times larger than `se_diff` the difference is quite
61-
#' certain).
62-
#'
63-
#' The `k_diff` value for the `diag_diff` column is computed using the
64-
#' pointwise ELPD differences (and is different from the Pareto k's in
65-
#' PSIS-LOO diagnostic). While `k_diff > 0.5` indicates the *possibility* of
66-
#' outliers, it is also possible that both models compared seem to be well
67-
#' specified based on model checking, but the pointwise ELPD differences have
68-
#' such thick tails that the normal approximation for the sum is not good
69-
#' (Vehtari et al., 2024). A threshold of 0.5 is used for `k_diff` as we do
70-
#' not do automatic Pareto smoothing for the pointwise differences (Vehtari et
71-
#' al., 2024).
56+
#' `p_worse` are likely to be too large. However, `elpd_diff` and `se_diff`
57+
#' will still be indicative of the differences and uncertainties (for example,
58+
#' if `|elpd_diff|` is many times larger than `se_diff` the difference is quite
59+
#' certain). In addition, if the model is not well specificed and there are
60+
#' outliers, the error distribution can also be skewed or thick tailed and the
61+
#' normal approximation is not well calibrated. Possible model misspecification
62+
#' and outliers can be diagnosed with usual predictive checking methods.
7263
#'
7364
#' The column `diag_elpd` shows the PSIS-LOO Pareto k diagnostic for the
7465
#' pointwise ELPD computations for each model. If `K k_psis > 0.7` is shown,
@@ -433,12 +424,6 @@ diag_diff <- function(N, elpd_diff) {
433424
} else {
434425
diag_diff <- rep("", length(elpd_diff))
435426
diag_diff[elpd_diff > -4 & elpd_diff != 0] <- "|elpd_diff| < 4"
436-
k_diff <- rep(NA, length(elpd_diff))
437-
k_diff[elpd_diff != 0] <- apply(
438-
diffs[, elpd_diff != 0, drop = FALSE], 2,
439-
function(x) ifelse(length(unique(x)) <= 20, NA, posterior::pareto_khat(x, tail = "both")
440-
))
441-
diag_diff[k_diff > 0.5] <- "k_diff > 0.5"
442427
}
443428
diag_diff
444429
}

0 commit comments

Comments
 (0)