Skip to content

Commit 62027d1

Browse files
committed
fix issues in preliminary reverse dependency checks
1 parent 25f93fd commit 62027d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

R/loo_compare.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ loo_compare.default <- function(x, ...) {
113113
# compute elpd_diff and se_elpd_diff relative to best model
114114
rnms <- rownames(comp)
115115
diffs <- mapply(FUN = elpd_diffs, loos[ord[1]], loos[ord])
116+
colnames(diffs) <- rnms
116117
elpd_diff <- apply(diffs, 2, sum)
117118
se_diff <- apply(diffs, 2, se_elpd_diff)
118119

@@ -135,7 +136,7 @@ loo_compare.default <- function(x, ...) {
135136
khat_diff <- rep(NA, length(elpd_diff))
136137
khat_diff[elpd_diff != 0] <- apply(
137138
diffs[, elpd_diff != 0, drop = FALSE], 2,
138-
\(x) ifelse(length(unique(x)) <= 20, NA, posterior::pareto_khat(x, tail = "both")
139+
function (x) ifelse(length(unique(x)) <= 20, NA, posterior::pareto_khat(x, tail = "both")
139140
))
140141
diag_pnorm[khat_diff > 0.5] <- paste0("khat_diff > 0.5")
141142
}

0 commit comments

Comments
 (0)