Skip to contents

Reproduces boot::tsboot for the sim = "fixed" (moving block) and sim = "geom" (stationary) resampling schemes.

Usage

morie_tsboot(
  tseries,
  statistic,
  R,
  l,
  sim = "fixed",
  endcorr = TRUE,
  n.sim = NROW(tseries),
  ...
)

Arguments

tseries

A numeric vector / matrix (the series).

statistic

Function (series) -> numeric.

R

Number of replicates.

l

Block length.

sim

"fixed" (moving block, default) or "geom" (stationary bootstrap).

endcorr

Apply end-correction (default TRUE).

n.sim

Length of each simulated series (default NROW).

...

Passed on to statistic.

Value

A morie_boot object (t0, t, R).

References

Politis, D. N., & Romano, J. P. (1994). The stationary bootstrap. JASA, 89(428), 1303-1313.

Examples

set.seed(1)
b <- morie_tsboot(stats::as.ts(rnorm(60)), statistic = mean,
                  R = 100L, l = 5)
str(b, max.level = 1)
#> List of 3
#>  $ t0: num 0.108
#>  $ t : num [1:100, 1] -0.1808 0.0667 0.1749 0.0538 0.0512 ...
#>  $ R : int 100
#>  - attr(*, "class")= chr "morie_boot"