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().
Usage
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)
)Arguments
- .mod
model object to update.
- .parent_mod
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 inget_based_on(.mod))- inherit
type of estimates to inherit from parent model. Defaults to replacing all of THETA, SIGMA, and OMEGA
- bounds
Whether to keep or discard the existing bounds when setting the initial estimates in THETA records.
- digits
Number of significant digits to round estimates to.
- .bbi_args
Named list passed to
model_summary(.bbi_args). Seeprint_bbi_args()for valid options. Defaults tolist(no_grd_file = TRUE, no_shk_file = TRUE)becausemodel_summary()is only called internally to extract the parameter estimates, so those files are irrelevant.
Details
Constraints and limitations
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. Callinginherit_param_estimates()with theta estimatesc(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
THETAPandTHETAPV).
Examples
if (FALSE) { # \dontrun{
base_mod <- read_model(file.path(MODEL_DIR, "1"))
mod2 <- copy_model_from(base_mod, "mod2") %>%
inherit_param_estimates()
} # }
