Skip to contents

Returns the session-only RTMB objective associated with an sbt_fit(). Strict reads build and cache this objective, so the default access is cheap and does not reconstruct model state a second time. Set fresh = TRUE only for operations, such as sampling, that may mutate the objective; the fresh object is deliberately not placed in the shared runtime cache.

Usage

sbt_obj(x, fresh = FALSE)

Arguments

x

An sbt_fit object.

fresh

Logical; construct an isolated fresh objective instead of returning the session-cached objective.

Value

An RTMB objective restored at the saved optimum when available, or at the configured starting values for an unoptimized fit.

Examples

if (FALSE) { # \dontrun{
fit <- sbt_example_fit()
object <- sbt_obj(fit)
length(object$par)
} # }