Recreates the RTMB objective from the stored data, fitted parameter state, map, and random-effect specification, then restores the optimizer parameter vector. By default the current scientific contract, parameter layout, and objective value must agree with the saved run. An implementation-checksum difference alone is permitted within an unchanged scientific contract. Rebuilt objectives are session-only and never serialized.
Usage
sbt_fit_rebuild(
x,
strict = TRUE,
check_objective = TRUE,
tolerance = 1e-06,
silent = FALSE,
cache = TRUE
)Arguments
- x
An
sbt_fitobject.- strict
If
TRUE, stop on model-schema, function-signature, parameter, or objective mismatches. IfFALSE, warn where a safe rebuild can still be attempted.- check_objective
Compare the rebuilt objective with
opt$objective.- tolerance
Relative tolerance passed to
base::all.equal()for the objective comparison.- silent
Passed to
RTMB::MakeADFun().- cache
Cache the rebuilt objective for plots and subsequent model operations in the current R session.
Value
A newly constructed RTMB objective restored to the saved optimum when
available. The objective is transient and is not added to the serialized
sbt_fit payload.
See also
Other fit workflow:
check_mcmc(),
check_mle(),
sbt_add_bounds(),
sbt_add_map(),
sbt_add_msy(),
sbt_add_parameters(),
sbt_add_priors(),
sbt_build_object(),
sbt_example_fit(),
sbt_fit(),
sbt_fit_compatibility(),
sbt_fit_io,
sbt_fit_report(),
sbt_fit_validate(),
sbt_fit_validation(),
sbt_mcmc(),
sbt_obj(),
sbt_optimise()
Examples
if (FALSE) { # \dontrun{
fit <- sbt_example_fit(rebuild = FALSE)
object <- sbt_fit_rebuild(fit)
object$fn(object$par)
} # }
