Resamples blocks of consecutive observations. Delegates to
boot::tsboot when boot is installed (fixed and
stationary / geometric blocks); a circular-block path is
implemented inline because boot::tsboot does not expose a
circular-block sim mode directly. Falls back to a pure-R loop
otherwise.
Usage
block_bootstrap(
data,
statistic,
block_size,
n_boot = 2000L,
ci_level = 0.95,
method = "circular",
seed = 42L
)Examples
set.seed(1)
ts_dat <- as.numeric(arima.sim(list(ar = 0.4), n = 50L))
res <- block_bootstrap(ts_dat, mean, block_size = 5L, n_boot = 20L,
method = "circular")
res$estimate
#> [1] 0.1878789
