From 2d4a3fbb2f07f7492e5f9545917d698b891587b0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 3 Oct 2023 20:43:32 +0200 Subject: [PATCH] minor --- R/r2.R | 6 +++++- tests/testthat/test-nestedLogit.R | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/R/r2.R b/R/r2.R index 26a16f9e6..c0a53af64 100644 --- a/R/r2.R +++ b/R/r2.R @@ -291,7 +291,7 @@ r2.glm <- function(model, ci = NULL, verbose = TRUE, ...) { if (info$family %in% c("gaussian", "inverse.gaussian")) { out <- r2.default(model, ...) } else if (info$is_logit && info$is_bernoulli) { - out <- list("R2_Tjur" = r2_tjur(model, ...)) + 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)) @@ -312,6 +312,10 @@ r2.glm <- function(model, ci = NULL, verbose = TRUE, ...) { #' @export r2.glmx <- r2.glm +#' @export +r2.nestedLogit <- function(model, ci = NULL, verbose = TRUE, ...) { + lapply(r2, model$models, ci = ci, verbose = verbose, ...) +} diff --git a/tests/testthat/test-nestedLogit.R b/tests/testthat/test-nestedLogit.R index 73fd093f8..beaa701d4 100644 --- a/tests/testthat/test-nestedLogit.R +++ b/tests/testthat/test-nestedLogit.R @@ -1,3 +1,4 @@ +skip_on_os(c("mac", "linux")) skip_if_not_installed("nestedLogit") skip_if_not_installed("carData")