bootstrap_tna: Bootstrap a TNA model

View source: R/workflows.R

bootstrap_tnaR Documentation

Bootstrap a TNA model

Description

Bootstrap a TNA model

Usage

bootstrap_tna(
  data,
  model = c("tna", "ftna", "ctna", "atna"),
  repetitions = 100L,
  fraction = 1,
  format = c("auto", "long", "wide"),
  id = "id",
  period = "period",
  state = "state",
  group = NULL,
  seed = NULL,
  ...
)

Arguments

data

Sequence data in long or wide form.

model

TNA estimator, one of "tna" (the default), "ftna", "ctna", "atna".

repetitions

Single whole number of bootstrap samples, at least 2, default 100.

fraction

Single number in ⁠(0, 1]⁠ giving the fraction of sequences drawn with replacement in each repetition, default 1. At least two sequences are always drawn.

format, id, period, state, group

Arguments describing the shape and column names of data. They are used to reshape data before resampling; the resampled sequences are then fitted in wide form, so only group is forwarded to fit_tna(). group resamples within each group.

seed

Optional single seed, restored on exit and recorded on the result.

...

Further arguments passed to fit_tna().

Value

A simulab_sim edge list with one row per repetition and transition: a leading iteration column followed by the columns fit_tna() returns. The summary component holds one row per edge (per group, when group is given) with the bootstrap mean, sd, and the 2.5% and 97.5% percentiles as lower and upper.

Examples

data <- simulate_sequences(n = 40, n_states = 3, chain_length = 12, seed = 1)
if (requireNamespace("tna", quietly = TRUE)) {
  head(bootstrap_tna(data, model = "tna", repetitions = 5, seed = 1))
}

simulab documentation built on Oct. 15, 2026, 5:08 p.m.