Skip to contents

Sanity check of sdmTMB model

Usage

sanity(fit, big_sd_log10 = 3, gradient_thresh = 0.001)

Arguments

fit

Fitted model from sdmTMB()

big_sd_log10

Value to check size of standard errors against. A value of 3 would indicate that standard errors greater than 10^3 should be flagged.

gradient_thresh

Gradient threshold to issue warning

Value

An invisible named list of checks

Examples

fit <- sdmTMB(
  present ~ s(depth),
  data = pcod_2011, mesh = pcod_mesh_2011,
  family = binomial()
)
sanity(fit)
#>  Non-linear minimizer suggests successful convergence
#>  Hessian matrix is positive definite
#>  No extreme or very small eigenvalues detected
#>  No gradients with respect to fixed effects are >= 0.001
#>  No fixed-effect standard errors are NA
#>  No standard errors look unreasonably large
#>  No sigma parameters are < 0.01
#>  No sigma parameters are > 100
#>  Range parameter doesn't look unreasonably large

s <- sanity(fit)
#>  Non-linear minimizer suggests successful convergence
#>  Hessian matrix is positive definite
#>  No extreme or very small eigenvalues detected
#>  No gradients with respect to fixed effects are >= 0.001
#>  No fixed-effect standard errors are NA
#>  No standard errors look unreasonably large
#>  No sigma parameters are < 0.01
#>  No sigma parameters are > 100
#>  Range parameter doesn't look unreasonably large
s
#> $hessian_ok
#> [1] TRUE
#> 
#> $eigen_values_ok
#> [1] TRUE
#> 
#> $nlminb_ok
#> [1] TRUE
#> 
#> $range_ok
#> [1] TRUE
#> 
#> $gradients_ok
#> [1] TRUE
#> 
#> $se_magnitude_ok
#> [1] TRUE
#> 
#> $se_na_ok
#> [1] TRUE
#> 
#> $sigmas_ok
#> [1] TRUE
#> 
#> $all_ok
#> [1] TRUE
#>