The model estimation for each bootstrap sample uses the same method and
tolerances as the original fit. If you want to change these, you can modify
the elements of the input model such as model$estimation_results$method
and model$controls
before passing it to bootstrap_coefs()
.
bootstrap_coefs(model, ...)# S3 method for nhmm
bootstrap_coefs(
model,
nsim,
type = c("nonparametric", "parametric"),
append = FALSE,
...
)
# S3 method for mnhmm
bootstrap_coefs(
model,
nsim,
type = c("nonparametric", "parametric"),
append = FALSE,
...
)
The original model with additional element model$boot
.
An nhmm
or mnhmm
object.
Ignored.
number of bootstrap samples.
Either "nonparametric"
(default) or "parametric"
, to define
whether nonparametric or parametric bootstrap should be used. The former samples
sequences with replacement, whereas the latter simulates new datasets based
on the model.
If TRUE
, in case the model already contains
bootstrap samples, new samples are appended to model$boot
. If FALSE
(default), old samples are discarded.
It is possible to parallelize the bootstrap runs using the future
package,
e.g., by calling future::plan(multisession, workers = 2)
before
bootstrap_coefs()
. See future::plan()
for details.
bootstrap_coefs()
is compatible with progressr
package, so you can use
progressr::with_progress(bootstrap_coefs(fit))
to track the progress of
bootstrapping.