diff --git a/R/residuals.R b/R/residuals.R index 61424679c..5c638fdda 100644 --- a/R/residuals.R +++ b/R/residuals.R @@ -301,15 +301,17 @@ residuals.sdmTMB <- function(object, ...) { type_was_missing <- missing(type) type <- match.arg(type[[1]], choices = c("mle-mvn", "mle-laplace", "mle-eb", "mle-mcmc", "response", "pearson")) - if (type_was_missing || type == "mle-laplace") { - msg <- paste0("Note what used to be the default sdmTMB residuals ", - "(before version 0.4.3.9005) are now `type = 'mle-eb'`. We recommend using ", - "the current default `'mle-mvn'`, which takes one sample from the approximate ", - "posterior of the random effects or `dharma_residuals()` using a similar ", - "approach.") - cli_inform(msg) - if (type == "mle-laplace") type <- "mle-eb" + if (!"visreg_model" %in% names(object)) { + if (type_was_missing || type == "mle-laplace") { + msg <- paste0("Note what used to be the default sdmTMB residuals ", + "(before version 0.4.3.9005) are now `type = 'mle-eb'`. We recommend using ", + "the current default `'mle-mvn'`, which takes one sample from the approximate ", + "posterior of the random effects or `dharma_residuals()` using a similar ", + "approach.") + cli_inform(msg) + } } + if (type == "mle-laplace") type <- "mle-eb" model_missing <- FALSE if (identical(model, c(1, 2))) model_missing <- TRUE model <- as.integer(model[[1]]) diff --git a/tests/testthat/test-7-visreg.R b/tests/testthat/test-1-visreg.R similarity index 100% rename from tests/testthat/test-7-visreg.R rename to tests/testthat/test-1-visreg.R