diff --git a/R/r2.R b/R/r2.R index 85fbd03ef..f1399ce0d 100644 --- a/R/r2.R +++ b/R/r2.R @@ -496,11 +496,11 @@ r2.glmmTMB <- function(model, ci = NULL, tolerance = 1e-5, verbose = TRUE, ...) if (!is.null(ci) && !is.na(ci)) { return(.r2_ci(model, ci = ci, ...)) } - mi <- insight::model_info(model, verbose = FALSE) - if (mi$is_linear) { + info <- insight::model_info(model, verbose = FALSE) + if (info$is_linear) { out <- .safe(.r2_lm_manual(model)) - } else if (mi$is_logit && mi$is_bernoulli) { - out <- list(R2_Tjur = r2_tjur(model, model_info = mi, ...)) + } else if (info$is_logit && info$is_bernoulli) { + out <- list(R2_Tjur = r2_tjur(model, model_info = info, ...)) attr(out, "model_type") <- "Logistic" names(out$R2_Tjur) <- "Tjur's R2" class(out) <- c("r2_pseudo", class(out)) diff --git a/R/r2_nagelkerke.R b/R/r2_nagelkerke.R index e97e8fb6f..f476c2e0c 100644 --- a/R/r2_nagelkerke.R +++ b/R/r2_nagelkerke.R @@ -96,7 +96,7 @@ r2_nagelkerke.glmmTMB <- function(model, verbose = TRUE, ...) { return(NULL) } null_dev <- stats::deviance(insight::null_model(model)) - r2_cox <- (1 - exp((dev - null_dev) / insight::n_obs(model, disaggregate = TRUE))) + r2cox <- (1 - exp((dev - null_dev) / insight::n_obs(model, disaggregate = TRUE))) if (is.na(r2cox) || is.null(r2cox)) { return(NULL) }