| ctboot | R Documentation |
Joint block bootstrap for generating probabilistic base forecasts that take into account the correlation between variables at different temporal aggregation orders (Girolimetto et al. 2023).
ctboot(model_list, boot_size, agg_order, block_size = 1, seed = NULL,
xreg = NULL, ...)
model_list |
A list of |
boot_size |
The number of bootstrap replicates. |
agg_order |
Highest available sampling frequency per seasonal cycle
(max. order of temporal aggregation, |
block_size |
Block size of the bootstrap, which is typically equivalent to the forecast horizon for the most temporally aggregated series. |
seed |
An integer seed. |
xreg |
An optional 3-d numeric array of dimensions
( |
... |
Additional arguments for the |
A list with \text{boot\_size} matrix of size
(n\times(k^\ast+m)\text{block\_size}).
Girolimetto, D., Athanasopoulos, G., Di Fonzo, T. and Hyndman, R.J. (2024), Cross-temporal probabilistic forecast reconciliation: Methodological and practical issues. International Journal of Forecasting, 40, 3, 1134-1151. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.ijforecast.2023.10.003")}
Bootstrap samples:
csboot(),
teboot()
Cross-temporal framework:
ctbu(),
ctcov(),
ctlcc(),
ctmo(),
ctmvn(),
ctrec(),
ctsmp(),
cttd(),
cttools(),
iterec(),
tcsrec()
set.seed(123)
# Minimal example functions: each "model" stores Gaussian residuals;
# simulate() draws new innovations (innov=NULL) or uses the supplied
# ones (innov given).
simple_model <- function(res) {
structure(list(residuals = res, sigma = sd(res)), class = "simple_model")
}
simulate.simple_model <- function(object, nsim = 1, innov = NULL,
future = TRUE, ...) {
if (is.null(innov)) {
rnorm(nsim, mean = 0, sd = object$sigma)
} else {
as.numeric(innov)[seq_len(nsim)]
}
}
# Cross-temporal hierarchy:
# - cross-sectional: Z = X + Y => n = 3
# - temporal: annual-quarterly => m = 4, kset = c(4, 2, 1), p = 3 levels
n <- 3
m <- 4
kset <- c(4, 2, 1)
n_obs_per_k <- 40 / kset
# Nested list: outer level = p temporal aggregation orders (low -> high
# frequency), inner level = n cross-sectional series.
model_list <- lapply(seq_along(kset), function(i) {
lapply(seq_len(n), function(j) {
simple_model(rnorm(n_obs_per_k[i]))
})
})
# Joint block bootstrap: 50 replicates, block_size = 1
boot <- ctboot(model_list = model_list, boot_size = 50, agg_order = m,
block_size = 1, seed = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.