hhj {blocklength} | R Documentation |
Hall, Horowitz, and Jing (1995) "HHJ" Algorithm to Select the Optimal Block-Length
Description
Perform the Hall, Horowitz, and Jing (1995) "HHJ" cross-validation algorithm to select the optimal block-length for a bootstrap on dependent data (block-bootstrap). Dependent data such as stationary time series are suitable for usage with the HHJ algorithm.
Usage
hhj(
series,
nb = 100L,
n_iter = 10L,
pilot_block_length = NULL,
sub_sample = NULL,
k = "two-sided",
bofb = 1L,
search_grid = NULL,
grid_step = c(1L, 1L),
cl = NULL,
verbose = TRUE,
plots = TRUE
)
Arguments
series |
a numeric vector or time series giving the original data for which to find the optimal block-length for. |
nb |
an integer value, number of bootstrapped series to compute. |
n_iter |
an integer value, maximum number of iterations for the HHJ algorithm to compute. |
pilot_block_length |
a numeric value, the block-length ( |
sub_sample |
a numeric value, the length of each overlapping
subsample, |
k |
a character string, either |
bofb |
a numeric value, length of the basic blocks in the
block-of-blocks bootstrap, see |
search_grid |
a numeric value, the range of solutions around |
grid_step |
a numeric value or vector of at most length 2, the number of
steps to increment over the subsample block-lengths when evaluating the
|
cl |
a cluster object, created by package parallel,
doParallel, or snow. If |
verbose |
a logical value, if set to |
plots |
a logical value, if set to |
Details
The HHJ algorithm is computationally intensive as it relies on a
cross-validation process using a type of subsampling to estimate the mean
squared error (MSE
) incurred by the bootstrap at various block-lengths.
Under-the-hood, hhj()
makes use of tsbootstrap
,
see Trapletti and Hornik (2020), to perform the moving block-bootstrap
(or the block-of-blocks bootstrap by setting bofb > 1
) according
to Kunsch (1989).
Value
an object of class 'hhj'
References
Adrian Trapletti and Kurt Hornik (2020). tseries: Time Series Analysis and Computational Finance. R package version 0.10-48.
Kunsch, H. (1989) The Jackknife and the Bootstrap for General Stationary Observations. The Annals of Statistics, 17(3), 1217-1241. Retrieved February 16, 2021, from http://www.jstor.org/stable/2241719
Peter Hall, Joel L. Horowitz, Bing-Yi Jing, On blocking rules for the bootstrap with dependent data, Biometrika, Volume 82, Issue 3, September 1995, Pages 561-574, DOI: doi: 10.1093/biomet/82.3.561
Examples
# Generate AR(1) time series
sim <- stats::arima.sim(list(order = c(1, 0, 0), ar = 0.5),
n = 500, innov = rnorm(500))
# Calculate optimal block length for series
hhj(sim, sub_sample = 10)
# Use parallel computing
library(parallel)
# Make cluster object with 2 cores
cl <- makeCluster(2)
# Calculate optimal block length for series
hhj(sim, cl = cl)