Set the initial parameter estimates of a model using the estimates of a
previously executed model. Often this is used to carry forward the final
estimates of a "parent" model to be used as the initial estimates of the
"child" model, for example a model created with copy_model_from()
.
inherit_param_estimates(
.mod,
.parent_mod = get_based_on(.mod)[1],
inherit = c("theta", "sigma", "omega"),
bounds = c("keep", "discard"),
digits = 3,
.bbi_args = list(no_grd_file = TRUE, no_shk_file = TRUE)
)
model object to update.
Either a model object, or path to a model to inherit
properties from. Defaults to the "parent" model of .mod
(i.e. the first
entry in get_based_on(.mod)
)
type of estimates to inherit from parent model. Defaults to replacing all of THETA, SIGMA, and OMEGA
Whether to keep or discard the existing bounds when setting the initial estimates in THETA records.
Number of significant digits to round estimates to.
Named list passed to model_summary(.bbi_args)
. See
print_bbi_args()
for valid options. Defaults to list(no_grd_file = TRUE, no_shk_file = TRUE)
because model_summary()
is only called internally to
extract the parameter estimates, so those files are irrelevant.
These functions update initial estimates only if they are explicitly defined in the control stream.
For example, consider the update of $THETA (1)x4
. That defines four
initial estimates, but only the first explicitly appears. Calling
inherit_param_estimates()
with theta estimates c(5, 6, 7, 8)
would
return a result of (5)x4
.
Using additional parameter records for priors is not supported and will
lead to a size mismatch between the parameter and its records. Instead use
informative prior record names (such as THETAP
and THETAPV
).
if (FALSE) {
base_mod <- read_model(file.path(MODEL_DIR, "1"))
mod2 <- copy_model_from(base_mod, "mod2") %>%
inherit_param_estimates()
}