R/copy-model-from.R
copy_model_as_stan_gq.RdLike bbr::copy_model_from(), but switch the model type from "stan" to
"stan_gq" begin defining a model for standalone generated quantities.
copy_model_as_stan_gq(
.parent_mod,
.new_model = paste0(bbr::get_model_id(.parent_mod), "_gq"),
.description = NULL,
.based_on_additional = NULL,
.add_tags = NULL,
.star = NULL,
.inherit_tags = FALSE,
.overwrite = FALSE
)A bbi_stan_model object to copy. This should not be a
bbi_stan_gq_model subclass; in that case, use bbr::copy_model_from() to
copy the model in the standard way.
Path to the new model, either absolute or relative to the
path to .parent_mod. By default, this is the parent's model name with
"_gq" appended. Aside from the default value, this is handled in the same
way as the .new_model argument of bbr::copy_model_from().
Character scalar description of new model run. This will
be stored in the yaml (and can be viewed later in run_log()).
Character vector of path(s) to other models that
this model was "based on." These are used to reconstuct model developement
and ancestry. Paths must be relative to .new_model path. Note that
the .parent_model will automatically be added to the based_on field, so
no need to include that here.
Character vector with any new tags(s) to be added to
{.new_model}.yaml
Boolean, marks model to indicate special interest level.
If FALSE, the default, new model will only have any
tags passed to .add_tags argument. If TRUE inherit any tags from
.parent_mod, with any tags passed to .add_tags appended.
If FALSE, the default, function will error if a model
file already exists at specified .new_model path. If TRUE any existing
file at .new_model will be overwritten silently.
A bbi_stan_gq_model object for the new model.
Aside from adjusting the model_type value in the new model's YAML file,
this function does the following:
adds a <run>-fitted-param.R file. Its value may be suitable for your
purposes, but please inspect it and edit as needed.
copies <run>.stan and <run>-standata.R as is from the parent model. At
least <run>.stan will need to be manually modified before running the
model.
<run>-init.R is not copied because it is not relevant for standalone
generated quantities.
Only the seed argument from the parent model's <run>-stanargs.R is
copied to the new model's <run>-stanargs.R.
Sets "gq_parent" field of .new_model to point to .parent_mod.
bbr_stan for a high-level description of how Stan models are structured