diff --git a/R/check_model_diagnostics.R b/R/check_model_diagnostics.R index ef0e2e2d7..ff9482934 100644 --- a/R/check_model_diagnostics.R +++ b/R/check_model_diagnostics.R @@ -53,10 +53,10 @@ if (is.null(res_) || all(is.na(res_))) { if (verbose) { - if (!is.null(model_info$family)) { - fam <- paste0("`", model_info$family, "`") - } else { + if (is.null(model_info$family)) { fam <- "model" + } else { + fam <- paste0("`", model_info$family, "`") } insight::format_alert( paste( diff --git a/tests/testthat/test-check_model.R b/tests/testthat/test-check_model.R index 4a3d23703..06973756f 100644 --- a/tests/testthat/test-check_model.R +++ b/tests/testthat/test-check_model.R @@ -51,3 +51,24 @@ test_that("`check_model()` works for quantreg", { x <- check_model(qm, verbose = FALSE) expect_s3_class(x, "check_model") }) + +test_that("`check_model()` warnings for tweedie", { + skip_if_not_installed("glmmTMB") + skip_if_not_installed("lme4") + data(sleepstudy, package = "lme4") + set.seed(123) + d <- sleepstudy[sample.int(50), ] + m <- suppressWarnings(glmmTMB::glmmTMB(Reaction ~ Days, + data = d, + family = glmmTMB::tweedie + )) + expect_message( + expect_message( + expect_message( + check_model(m, iterations = 1, verbose = TRUE), + regex = "Not enough model terms" + ), + regex = "QQ plot could not" + ) + ) +})