diff --git a/NEWS.md b/NEWS.md index b26a3864..0b0d8b13 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,11 @@ * Switch unit tests from Travis to GitHub Actions. (#164) +### Bug fixes + +* Fixed a bug causing the normalizing constant of the PSIS (log) weights not +to get updated when performing moment matching with `save_psis = TRUE` (#166, @fweber144). + # loo 2.4.1 * Fixed issue reported by CRAN where one of the vignettes errored on an M1 Mac diff --git a/R/loo_moment_matching.R b/R/loo_moment_matching.R index 0a5cc03e..ceb9242c 100644 --- a/R/loo_moment_matching.R +++ b/R/loo_moment_matching.R @@ -151,6 +151,7 @@ loo_moment_match.default <- function(x, loo, post_draws, log_lik_i, } } if (!is.null(loo$psis_object)) { + attr(loo$psis_object, "norm_const_log") <- matrixStats::colLogSumExps(loo$psis_object$log_weights) loo$psis_object$diagnostics <- loo$diagnostics }