Skip to content

Commit f7ac91b

Browse files
update defaults; test for any violation w/ err message
1 parent ebe5fe2 commit f7ac91b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: R/model-evaluation.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ NULL
117117

118118
#' @export
119119
#' @rdname model_evaluation
120-
add_criterion <- function(x, criterion = c("loo", "waic", "aic", "bic"),
120+
add_criterion <- function(x, criterion = c("loo", "waic"),
121121
overwrite = FALSE, save = TRUE, ..., r_eff = NA) {
122122
model <- check_model(x, required_class = "measrfit", name = "x")
123-
if (model$method != "mcmc" & criterion %in% c("loo", "waic")) {
123+
if (any(model$method != "mcmc" & criterion %in% c("loo", "waic"))) {
124124
rlang::abort("error_bad_method",
125125
message = glue::glue("LOO and WAIC model criteria are only ",
126126
"available for models estimated with ",
127127
"`method = \"mcmc\"`."))
128-
} else if (model$method != "optim" & criterion %in% c("aic", "bic")) {
128+
} else if (any(model$method != "optim" & criterion %in% c("aic", "bic"))) {
129129
rlang::abort("error_bad_method",
130130
message = glue::glue("AIC and BIC model criteria are only ",
131131
"available for models estimated with ",

0 commit comments

Comments
 (0)