Iterative procedure which produces cross-temporally reconciled forecasts by alternating forecast reconciliation along one single dimension (either cross-sectional or temporal) at each iteration step. Each iteration consists in the first two steps of the heuristic procedure by Kourentzes and Athanasopoulos (2019), so the forecasts are reconciled by alternating cross-sectional (contemporaneous) reconciliation, and reconciliation through temporal hierarchies in a cyclic fashion. The choice of the dimension along which the first reconciliation step in each iteration is performed is up to the user (param start_rec), and there is no particular reason why one should perform the temporal reconciliation first, and the cross-sectional reconciliation then. The iterative procedure allows the user to get non-negative reconciled forecasts.

iterec(basef, thf_comb, hts_comb, res, itmax = 100, tol = 1e-5,
start_rec = "thf", norm = "inf", note = TRUE, plot = "mti", ...)

## 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.

itmax

Max number of iteration (100, default) (old version maxit).

tol

Convergence tolerance (1e-5, default).

start_rec

Dimension along with the first reconciliation step in each iteration is performed: it start from temporal reconciliation with "thf" (default), from cross-sectional with "hts" and it does both reconciliation with "auto".

norm

Norm used to calculate the temporal and the cross-sectional incoherence. There are two alternatives: "inf" ($$\max{|x_1|, |x_2|,\dots}$$, default) or "one" ($$\sum |x_i|$$).

note

If note = TRUE (default) the function writes some notes to the console, otherwise no note is produced (also no plot).

plot

Some useful plots: "mti" (default) marginal trend inconsistencies, "pat" step by step inconsistency pattern for each iteration, "distf" distance forecasts iteration i and i-1, "all" all the plots.

...

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

iterec returns a list with:

recf

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

d_cs

Cross-sectional incoherence at each iteration.

d_te

Temporal incoherence at each iteration.

start_rec

Starting coherence dimension (thf or hts).

tol

Tolerance.

flag

Control code (see details).

time

Elapsed time.

dist

If start_rec = "auto", matrix of distances of the forecasts reconciled from the base.

## Details

This reconciliation procedure can be seen as an extension of the well known iterative proportional fitting procedure (Deming and Stephan, 1940, Johnston and Pattie, 1993), also known as RAS method (Miller and Blair, 2009), to adjust the internal cell values of a two-dimensional matrix until they sum to some predetermined row and column totals. In that case the adjustment follows a proportional adjustment scheme, whereas in the cross-temporal reconciliation framework each adjustment step is made according to the penalty function associated to the single-dimension reconciliation procedure adopted.

Control status of iterative reconciliation:

-2

Temporal/Cross-sectional reconciliation does not work.

-1

Convergence not achieved (maximum iteration limit reached).

0

Convergence achieved.

+1

Convergence achieved: incoherence has increased in the next iteration (at least one time).

+2

Convergence achieved: incoherence has increased in the next two or more iteration (at least one time).

+3

Other reconciliation procedures: cstrec(), ctbu(), htsrec(), lccrec(), octrec(), tcsrec(), tdrec(), thfrec()
# \donttest{
obj <- iterec(FoReco_data$base, note = FALSE, m = 12, C = FoReco_data$C, thf_comb = "acov",