Add or update parameters to be optimized/calibrated in a
flexmodel
object.
add_opt_params(model, ...)
update_opt_params(model, ...)
initialize_opt_params(model)
initialize_opt_tv_params(model)
update_opt_tv_params(model, tv_type = valid_tv_types, ...)
add_opt_tv_params(model, tv_type = valid_tv_types, ...)
flexmodel
object
a list of formulas for describing what parameters should be optimized, whether/how they should be transformed before being passed to the objective function, and what prior distribution (or regularization function should be used -- see the section on the formula syntax for more details.
type of time-variation for time-varying parameters,
which can be one of 'abs', 'rel_orig', 'rel_prev',
'rel_orig_logit', 'rel_orig_prev'
updated flexmodel
object
The left-hand-side of the formula describes the parameters and how they should be transformed, and the right-hand-side describes the associated prior distribution.
The simplest approach is to specify one parameter at a time with the following syntax:
trans_param ~ trans_prior(hyperparameters ...)
On the left-hand-side the optional transformation, trans
, is
separated by an underscore from the parameter name, param
. For
example one might optimize the transmission rate, beta
, on the
log scale by specifying the left-hand-side as log_beta
. To
optimize beta
on the untransformed scale the left-hand-side
would be simply be beta
. The currently available transformations
are log
, log10
, logit
, cloglog
, inverse
.
On the right-hand-side the optional transformation, trans
, is
separated from the name of the prior family by an underscore. This
transformation defines the scale on which the prior distribution is over.
Currently the transformation scale passed to the objective function
(on the left-hand-side) must match the transformation scale of the
priot (on the right-hand-side) -- perhaps this restriction will be
lifted one day. The currently available prior families are flat
(for no regularization) and normal
. These families are
expressed as functions of hyperparameters where the first argument
is a location parameter, which also defines the starting point of the
optimizer.
flat
the 'peak' of a flat function -- important because it sets the initial value of the optimizer.
normal
mean of the normal distribution, also used as the initial value of the optimizer
standard deviation of the normal distribution