From 5e4cf37649886c63833a65084ba18e0a14a61c36 Mon Sep 17 00:00:00 2001 From: jgabry Date: Tue, 5 Mar 2024 09:59:57 -0500 Subject: [PATCH] minor formatting --- R/helpers.R | 2 +- R/split_moment_matching.R | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/helpers.R b/R/helpers.R index e5b26d45..c2d6102e 100644 --- a/R/helpers.R +++ b/R/helpers.R @@ -57,7 +57,7 @@ validate_ll <- function(x) { stop("List not allowed as input.") } else if (anyNA(x)) { stop("NAs not allowed in input.") - } else if (any(x==Inf)) { + } else if (any(x == Inf)) { stop("All input values must be finite or -Inf.") } invisible(x) diff --git a/R/split_moment_matching.R b/R/split_moment_matching.R index 47f81ad8..b7bdb111 100644 --- a/R/split_moment_matching.R +++ b/R/split_moment_matching.R @@ -100,7 +100,7 @@ loo_moment_match_split <- function(x, upars, cov, total_shift, total_scaling, # lwi_half may have NaNs if computation involves -Inf + Inf # replace NaN log ratios with -Inf - lr<-lwi_half + lr <- lwi_half lr[is.na(lr)] <- -Inf is_obj_half <- suppressWarnings(importance_sampling.default(lr, method = is_method, @@ -110,7 +110,7 @@ loo_moment_match_split <- function(x, upars, cov, total_shift, total_scaling, # lwi_half may have NaNs if computation involves -Inf + Inf # replace NaN log ratios with -Inf - lr<-lwi_half + log_liki_half + lr <- lwi_half + log_liki_half lr[is.na(lr)] <- -Inf is_obj_f_half <- suppressWarnings(importance_sampling.default(lr, method = is_method,