bootstrap: Bootstrap Sampling of NHMM Coefficients

bootstrap_coefsR Documentation

Bootstrap Sampling of NHMM Coefficients

Description

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.

Usage

bootstrap_coefs(model, ...)

## S3 method for class 'nhmm'
bootstrap_coefs(
  model,
  nsim,
  type = c("nonparametric", "parametric"),
  append = FALSE,
  ...
)

## S3 method for class 'mnhmm'
bootstrap_coefs(
  model,
  nsim,
  type = c("nonparametric", "parametric"),
  append = FALSE,
  ...
)

Arguments

model

An nhmm or mnhmm object.

...

Additional arguments to estimate_nhmm() or estimate_mnhmm().

nsim

number of bootstrap samples.

type

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.

append

If TRUE, in case the model already contains bootstrap samples, new samples are appended to model$boot. If FALSE (default), old samples are discarded.

method

Estimation method used in bootstrapping. Defaults to "EM-DNM".

Details

bootstrap_coefs() is compatible with progressr package, so you can use progressr::with_progress(bootstrap_coefs(fit)) to track the progress of bootstrapping.

Value

The original model with additional element model$boot.


seqHMM documentation built on June 8, 2025, 10:16 a.m.