This function computes the optimal multi-task linear forecast combination for a temporally constrained time series, as described in Girolimetto and Di Fonzo (2024). It is the temporal counterpart of csmtc. Unlike teocc, the combined forecasts are not constrained to be temporally coherent.
Usage
temtc(
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 combined forecasts. Options include:
"
proj" (default): zero-constrained projection approach."
osqp": OSQP solver (Stellato et al., 2020).
- nn
A string specifying the algorithm to compute non-negative forecasts:
"
osqp": OSQP solver (Stellato et al., 2020)."
sntz": heuristic "set-negative-to-zero".
- 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.
References
Girolimetto, D. and Di Fonzo, T. (2024), Coherent forecast combination for linearly constrained multiple time series, doi:10.48550/arXiv.2412.03429 .
Stellato, B., Banjac, G., Goulart, P., Bemporad, A. and Boyd, S. (2020), OSQP: An Operator Splitting solver for Quadratic Programs, Mathematical Programming Computation, 12, 4, 637-672. doi:10.1007/s12532-020-00179-2
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 multi-task forecast combination
yc <- temtc(base = base, agg_order = 4, comb = "shr", res = res)