This function implements the optimal linear coherent forecast combination for a temporally constrained time series, combining forecasts from multiple sources (experts). It is the temporal counterpart of csocc: the method minimizes the forecast errors while ensuring that the combined forecasts are temporally coherent, meaning they satisfy the aggregation relations linking the high-frequency series and its temporally aggregated counterparts. Linear inequality constraints (e.g. non-negative forecasts) can be imposed, if needed.
Usage
teocc(
base,
agg_order,
comb = "ols",
tew = "sum",
res = NULL,
approach = "proj",
nn = NULL,
settings = NULL,
...
)Arguments
- base
A list of \(p\) numeric vectors, each of length \((k^\ast + m)h\), containing the base forecasts of a single expert to be reconciled; \(m\) is the maximum order of temporal aggregation, \(k^\ast\) is the sum of (a subset of) the factors of \(m\) (excluding \(m\) itself), \(h\) is the forecast horizon for the lowest-frequency (most aggregated) series, and \(p\) is the total number of experts. Each vector is ordered from the lowest frequency (most temporally aggregated) to the highest frequency (bottom-level) forecasts.
- agg_order
Highest available sampling frequency per seasonal cycle (max. order of temporal aggregation, \(m\)), or a vector representing a subset of \(p\) factors of \(m\).
- comb
A string specifying the reconciliation method. For details, see cscov.
- tew
A string specifying the type of temporal aggregation. Options include: "
sum" (simple summation, default), "avg" (average), "first" (first value of the period), and "last" (last value of the period).- res
A list of \(p\) numeric vectors, each of length \((k^\ast + m)N\), containing the in-sample residuals at all the temporal frequencies, ordered from the lowest to the highest frequency. This input is used to compute some covariance matrices.
- approach
A string specifying the approach used to compute the reconciled forecasts. Options include:
"
proj" (default): zero-constrained projection approach."
strc": structural approach.
- nn
A string specifying the algorithm to compute non-negative forecasts:
"
osqp": quadratic programming optimization (osqp solver, Girolimetto 2025)."
bpv": block principal pivoting algorithm (Wickramasuriya et al., 2020)."
nfca": negative forecasts correction algorithm (Kourentzes and Athanasopoulos, 2021; Girolimetto 2025)."
nnic": iterative non-negative reconciliation with immutable constraints (Girolimetto 2025)."
sntz": heuristic "set-negative-to-zero" (Di Fonzo and Girolimetto, 2023; Girolimetto 2025).
- settings
A list of control parameters.
nn = "osqp"An object of classosqpSettingsspecifying settings for the osqp solver. For details, refer to the osqp documentation (Stellato et al., 2020)nn = "bpv"ptype = "fixed": permutation method: "random" or "fixed"par = 10: the number of full exchange rules that may be attemptedtol = sqrt(.Machine$double.eps): the tolerance criteriagtol = sqrt(.Machine$double.eps): the gradient tolerance criteriaitmax = 100: the maximum number of algorithm iterations
nn = "nfca"andnn = "nnic"tol = sqrt(.Machine$double.eps): the tolerance criteriaitmax = 100: the maximum number of algorithm iterations
nn = "sntz"type = "bu": the type of set-negative-to-zero heuristic: "bu" for bottom-up, "tdp" for top-down proportional, "tdsp" for top-down square proportional, "tdvw" for top-down variance weighted (theresparam is used). See Girolimetto (2025) for details.tol = sqrt(.Machine$double.eps): the tolerance identification of negative values
- ...
Arguments passed on to cscov.
Value
An object of class foreco (see foreco-class)
with a (\(h(k^\ast+m) \times 1\)) numeric vector of temporal
reconciled forecasts.
Details
If an expert does not provide a forecast for a given temporal aggregation
order, the corresponding values can be represented as NA and the panel
of forecasts is treated as unbalanced.
References
Girolimetto, D. and Di Fonzo, T. (2024), Coherent forecast combination for linearly constrained multiple time series, doi:10.48550/arXiv.2412.03429 .
Examples
set.seed(123)
# Base forecasts' and residuals' lists for 2 experts,
# quarterly series (m = 4, k in {4, 2, 1}), forecast horizon h = 1
base <- list(rnorm(7, rep(c(20, 10, 5), c(1, 2, 4))),
rnorm(7, rep(c(20, 10, 5), c(1, 2, 4))))
res <- list(rnorm(70), rnorm(70))
# Temporal optimal coherent forecast combination
reco <- teocc(base = base, agg_order = 4, comb = "shr", res = res)