sanity | R Documentation |
Sanity check of an sdmTMB model
sanity(object, big_sd_log10 = 2, gradient_thresh = 0.001, silent = FALSE)
object |
Fitted model from |
big_sd_log10 |
Value to check size of standard errors against. A value
of 2 would indicate that standard errors greater than |
gradient_thresh |
Gradient threshold to issue warning. |
silent |
Logical: suppress messages? Useful to set to |
If object
is NA
, NULL
, or of class "try-error"
, sanity()
will
return FALSE
. This is to facilitate using sanity()
on models with try()
or tryCatch()
. See the examples section.
An invisible named list of checks.
fit <- sdmTMB(
present ~ s(depth),
data = pcod_2011, mesh = pcod_mesh_2011,
family = binomial()
)
sanity(fit)
s <- sanity(fit)
s
# If fitting many models in a loop, you may want to wrap
# sdmTMB() in try() to handle errors. sanity() will take an object
# of class "try-error" and return FALSE.
# Here, we will use stop() to simulate a failed sdmTMB() fit:
failed_fit <- try(stop())
s2 <- sanity(failed_fit)
all(unlist(s))
all(unlist(s2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.