The cross-temporal forecast reconciliation procedure by Kourentzes and Athanasopoulos (2019) can be viewed as an ensemble forecasting procedure which exploits the simple averaging of different forecasts. First, for each time series the forecasts at any temporal aggregation order are reconciled using temporal hierarchies (thfrec()), then time-by-time cross-sectional reconciliation is performed (htsrec()). The projection matrices obtained at this step are then averaged and used to cross-sectionally reconcile the forecasts obtained at step 1, by this way fulfilling both cross-sectional and temporal constraints.

tcsrec(basef, thf_comb, hts_comb, res, avg = "KA", ...)

## Arguments

basef

($$n \times h(k^\ast+m)$$) matrix of base forecasts to be reconciled, $$\widehat{\mathbf{Y}}$$; $$n$$ is the total number of variables, $$m$$ is the highest time frequency, $$k^\ast$$ is the sum of (a subset of) ($$p-1$$) factors of $$m$$, excluding $$m$$, and $$h$$ is the forecast horizon for the lowest frequency time series. Each row identifies a time series, and the forecasts are ordered as [lowest_freq' ... highest_freq']'.

hts_comb, thf_comb

Type of covariance matrix (respectively ($$n \times n$$) and ($$(k^\ast + m) \times (k^\ast + m)$$)) to be used in the cross-sectional and temporal reconciliation, see more in comb param of htsrec() and thfrec().

res

($$n \times N(k^\ast + m)$$) matrix containing the residuals at all the temporal frequencies ordered [lowest_freq' ... highest_freq']' (columns) for each variable (row), needed to estimate the covariance matrix when hts_comb = {"wls", "shr", "sam"} and/or hts_comb = {"wlsv", "wlsh", "acov", "strar1", "sar1", "har1", "shr", "sam"}. The row must be in the same order as basef.

avg

If avg = "KA" (default), the final projection matrix $$\mathbf{M}$$ is the one proposed by Kourentzes and Athanasopoulos (2019), otherwise it is calculated as simple average of all the involved projection matrices at step 2 of the procedure (see Di Fonzo and Girolimetto, 2020).

...

any other options useful for htsrec() and thfrec(), e.g. m, C (or Ut and nb), nn (for non negativity reconciliation only at first step), mse, corpcor, type, sol, settings, W, Omega,...

## Value

The function returns a list with two elements:

recf

($$n \times h(k^\ast + m)$$) reconciled forecasts matrix, $$\widetilde{\mathbf{Y}}$$.

M

Matrix which transforms the uni-dimensional reconciled forecasts of step 1 (projection approach) .

## Details

This function performs a two-step cross-temporal forecast reconciliation using the covariance matrices chosen by the user. If the combinations used by Kourentzes and Athanasopoulos (2019) are wished, thf_comb must be set equal to either "struc" or "wlsv", and hts_comb equal to either "shr" or "wls".

Warning, the two-step heuristic reconciliation allows non negativity constraints only in the first step. This means that non-negativity is not guaranteed in the final reconciled values.

Other reconciliation procedures: cstrec(), ctbu(), htsrec(), iterec(), lccrec(), octrec(), tdrec(), thfrec()
data(FoReco_data)
obj <- tcsrec(FoReco_data$base, m = 12, C = FoReco_data$C,