Skip to content

Commit

Permalink
fix translation of log liks before exponentiation
Browse files Browse the repository at this point in the history
  • Loading branch information
avehtari committed Jan 14, 2025
1 parent 79d3779 commit 0436f37
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/fit.R
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,8 @@ loo <- function(variables = "log_lik", r_eff = TRUE, moment_match = FALSE, ...)
if (is.logical(r_eff)) {
if (isTRUE(r_eff)) {
r_eff_cores <- list(...)[["cores"]] %||% getOption("mc.cores", 1)
r_eff <- loo::relative_eff(exp(LLarray + max(-LLarray)), cores = r_eff_cores)
r_eff <- loo::relative_eff(exp(sweep(LLarray, 3, apply(LLarray, 3, max), FUN = "-")),
cores = r_eff_cores)
} else {
r_eff <- NULL
}
Expand Down

0 comments on commit 0436f37

Please sign in to comment.