Calibrate Flexmodel
calibrate_flexmodel(
model,
.optimizer_wrapper = c("bbmle", "nlminb", "optim"),
...
)
flexmodel_to_calibrate
object, which is a
flexmodel
object that contains observed data added either
throught the data
argument in flexmodel
or with the
update_observed
function
name of a valid optimizer -- currently bbmle
is
recommended (see details for more information about the choices)
additional arguments to pass on to the optimizer
flexmodel_calibrated
object
Currently there are the following three optimizer wrappers.
bbmle_flexmodel
Wraps the mle2
function in the bbmle
package. This is
the recommended optimizer because it provides the ability to create
ensemble forecasts through simulate_ensemble
. Such
forecasts are possible because of the functionality provided in
bbmle
to generate from the sampling distribution of the
parameters. The variation induced by this sampling distribution is
used to create a distribution of simulation trajectories and therefore
confidence envelopes around forecasts or fits. The main limitation
of bbmle_flexmodel
is that it doesn't make use of
the Hessian matrix that is provided by TMB
through
auto-differentiation, although it does make use of the gradient.
nlminb_flexmodel
Wraps the nlminb_flexmodel
function. The main advantage
of this optimizer is that it allows one to make use of the Hessian
matrix (contrast with bbmle_flexmodel
). The main
disadvantage is that nlminb_flexmodel
does not allow
generating samples from the sampling distribution of the parameters,
and therefore does not allow for ensemble simulation.
optim_flexmodel
Wraps the standard optimizer in R, but neither allows the use of Hessians nor ensemble forecasts.