res2matrix | R Documentation |
These functions can be used to arrange residuals to reconcile temporal or cross-temporal forecasts.
res2matrix takes as input a set of temporal and cross-temporal residuals and re-organizes them into a matrix where the rows correspond to different forecast horizons, capturing the temporal dimension. Meanwhile, the columns are ordered based on the specific arrangement as described in Di Fonzo and Girolimetto (2023).
arrange_hres takes as input a list of multi-step residuals and is designed to organize them in accordance with their time order (Girolimetto et al. 2023). When applied, this function ensures that the sequence of multi-step residuals aligns with the chronological order in which they occurred.
res2matrix(res, agg_order)
arrange_hres(list_res)
res |
A ( |
agg_order |
Highest available sampling frequency per seasonal cycle (max. order
of temporal aggregation, |
list_res |
A list of |
Let Z_t
, t=1,\dots,T
, be a univariate time series. We can define the multi-step
residuals such us
\widehat{\varepsilon}_{h,t} = Z_{t+h} - \widehat{Z}_{t+h|t} \qquad h \le t \le T-h
where \widehat{Z}_{t+h|t}
is the h
-step fitted value, calculated as the h
-step ahead
forecast condition to the information up to time t
. Given the list of errors at different steps
\left([\widehat{\varepsilon}_{1,1}, \; \dots, \; \widehat{\varepsilon}_{1,T}], \dots, [\widehat{\varepsilon}_{H,1}, \; \dots, \; \widehat{\varepsilon}_{H,T}]\right),
arrange_hres returns a T
-vector with the residuals, organized in the following way:
[\varepsilon_{1,1} \; \varepsilon_{2,2} \; \dots \; \varepsilon_{H,H} \; \varepsilon_{1,H+1} \; \dots \; \varepsilon_{H,T-H}]'
A similar organisation can be apply to a multivariate time series.
res2matrix returns a (N \times n(k^\ast + m)
) matrix, where n = 1
for the temporal framework.
arrange_hres returns a (N(k^\ast+m) \times 1
) vector (temporal framework)
or a (n \times N(k^\ast+m)
) matrix (cross-temporal framework) of multi-step residuals.
Di Fonzo, T. and Girolimetto, D. (2023), Cross-temporal forecast reconciliation: Optimal combination method and heuristic alternatives, International Journal of Forecasting, 39, 1, 39-57. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.ijforecast.2021.08.004")}
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")}
Utilities:
FoReco2matrix()
,
aggts()
,
balance_hierarchy()
,
commat()
,
csprojmat()
,
cstools()
,
ctprojmat()
,
cttools()
,
df2aggmat()
,
lcmat()
,
recoinfo()
,
shrink_estim()
,
teprojmat()
,
tetools()
,
unbalance_hierarchy()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.