Skip to content

Commit

Permalink
Reduce messages with visreg, move up in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
seananderson committed Mar 26, 2024
1 parent bb18b8a commit 3f50fbe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions R/residuals.R
Original file line number Diff line number Diff line change
Expand Up @@ -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]])
Expand Down
File renamed without changes.

0 comments on commit 3f50fbe

Please sign in to comment.