Skip to contents

Rebuilds the model object from a portable fit, checks optimizer convergence, the independently recalculated maximum gradient, estimability, every MLE biological state (including mortality at every age), the harvest-wall implementation, and any LL4 contract embedded in the fit metadata.

Usage

check_mle(
  fit,
  gradient_tolerance = NULL,
  cores = 1L,
  mode = c("auto", "full", "skip"),
  stop_on_failure = TRUE
)

Arguments

fit

An sbt_fit() object.

gradient_tolerance

Optional maximum absolute gradient. By default the value is read from the fit's run identity, falling back to 0.01.

cores

Number of workers used for biological-state evaluation.

mode

Validation mode. "auto" reuses a matching embedded record and otherwise performs the check, "full" always performs the check, and "skip" returns the fit without checking or creating a record.

stop_on_failure

Stop when a gate fails. Set to FALSE to retain the MLE, store a failed validation record, and return it with a warning.

Value

The checked sbt_fit, with recalculated diagnostics stored in fit$fit$diagnostics and a payload-bound record stored in fit$validation.

Examples

fit <- sbt_example_fit(rebuild = FALSE)
#> Warning: Dependency versions differ: RTMBdist, TMB
fit <- check_mle(fit, mode = "auto")
sbt_fit_validation(fit, scope = "mle", require_pass = TRUE)$passes
#> [1] TRUE