Cross-temporal forecast reconciliation according to the heuristic procedure by Kourentzes and Athanasopoulos (2019), where the order of application of the two reconciliation steps (temporal-first-then-cross-sectional, as in the function tcsrec()), is inverted. The function cstrec() performs cross-sectional reconciliation (htsrec()) first, then temporal reconciliation (thfrec()), and finally applies the average of the projection matrices obtained in the second step to the one dimensional reconciled values obtained in the first step.

cstrec(basef, hts_comb, thf_comb, res, ...)

## 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 as [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 rows must be in the same order as basef.

...

any other options useful for htsrec() and thfrec(), e.g. m, C (or Ut and nb), nn (for non-negative reconciliation only at the 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

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

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