roll_bootstrap: Generates a rolling window bootstrap index vector to...

Description Usage Arguments Details Value

Description

This function generates an index vector that can be used to subset an xts matrix in a rolling window random fashion. For speed, the underlying code uses Rcpp to generate the random vectors.

Usage

1
roll_bootstrap(N, k = 3, nc = 1)

Arguments

N

The length of the vector we wish to generate

k

The rolling window width

nc

The number of columns to generate (number of vectors)

Details

The function is used to create synthetic time series by reordering the returns randomly in a rolling window fashion.

The implication is any autocorrelation between consecutive or near consecutive return samples will be randomly shuffled. However, the heteroscedastic properties of the series over longer time frames is mostly maintained.

Value

Returns a numeric matrix of N rows by nc columns. Consider using apply to then apply these index to generate an equivalent xts matrix. See examples to understand how to do this.


jeanmarcgp/xtsanalytics documentation built on May 19, 2019, 12:38 a.m.