Top-down forecast reconciliation for genuine hierarchical/grouped time series, where the forecast of a Total' (top-level series, expected to be positive) is disaggregated according to a proportional scheme given by a vector of proportions (weights). Besides the fulfillment of any aggregation constraint, the top-down reconciled forecasts should respect two main properties: - the top-level value remains unchanged; - all the bottom time series reconciled forecasts are non-negative. The top-down procedure is extended to deal with both temporal and cross-temporal cases. Since this is a post forecasting function, the weight vector must be given in input by the user, and is not calculated automatically (see Examples).

tdrec(topf, C, m, weights)

## Arguments

topf

($$h \times 1$$) vector of the top-level base forecast to be disaggregated; $$h$$ is the forecast horizon (for the lowest temporal aggregation order in temporal and cross-temporal cases).

C

($$n_a \times n_b$$) cross-sectional (contemporaneous) matrix mapping the $$n_b$$ bottom level series into the $$n_a$$ higher level ones.

m

Highest available sampling frequency per seasonal cycle (max. order of temporal aggregation, $$m$$), or a subset of the $$p$$ factors of $$m$$.

weights

vector of weights to be used to disaggregate topf: ($$n_b \times h$$) matrix in the cross-sectional framework; ($$m \times h$$) matrix in the temporal framework; ($$n_b m \times h$$) matrix in the cross-temporal framework.

## Value

The function returns an ($$h \times n$$) matrix of cross-sectionally reconciled forecasts, or an ($$h(k^\ast + m) \times 1$$) vector of top-down temporally reconciled forecasts, or an ($$n \times h (k^\ast + m)$$) matrix of top-down cross-temporally reconciled forecasts.

## Details

Fix $$h = 1$$, then $\widetilde{\mathbf{y}} = \mathbf{S}\mathbf{w}\widehat{a}_1$ where $$\widetilde{\mathbf{y}}$$ is the vector of reconciled forecasts, $$\mathbf{S}$$ is the summing matrix (whose pattern depends on which type of reconciliation is being performed), $$\mathbf{w}$$ is the vector of weights, and $$\widehat{a}_1$$ is the top-level value to be disaggregated.

## References

Athanasopoulos, G., Ahmed, R.A., Hyndman, R.J. (2009), Hierarchical forecasts for Australian domestic tourism, International Journal of Forecasting, 25, 1, 146–166.

Other reconciliation procedures: cstrec(), ctbu(), htsrec(), iterec(), lccrec(), octrec(), tcsrec(), thfrec()

## Examples

data(FoReco_data)
### CROSS-SECTIONAL TOP-DOWN RECONCILIATION
# Cross sectional aggregation matrix
C <- FoReco_data$C # monthly base forecasts id <- which(simplify2array(strsplit(colnames(FoReco_data$base), split = "_"))[1, ] == "k1")
mbase <- t(FoReco_data$base[, id]) obs_1 <- FoReco_data$obs$k1 # average historical proportions props <- colMeans(obs_1[1:168,-c(1:3)]/obs_1[1:168,1]) cs_td <- tdrec(topf = mbase[,1], C = C, weights = props) ### TEMPORAL TOP-DOWN RECONCILIATION # top ts base forecasts ([lowest_freq' ... highest_freq']') top_obs12 <- FoReco_data$obs$k12[1:14,1] bts_obs1 <- FoReco_data$obs$k1[1:168,1] # average historical proportions props <- colMeans(matrix(bts_obs1, ncol = 12, byrow = TRUE)/top_obs12) topbase <- FoReco_data$base[1, 1]
t_td <- tdrec(topf = topbase, m = 12, weights = props)

### CROSS-TEMPORAL TOP-DOWN RECONCILIATION
top_obs <- FoReco_data$obs$k12[1:14,1]
bts_obs <- FoReco_data$obs$k1[1:168,-c(1:3)]
bts_obs <- lapply(1:5, function(x) matrix(bts_obs[,x], nrow=14, byrow = TRUE))
bts_obs <- do.call(cbind, bts_obs)
# average historical proportions
props <- colMeans(bts_obs/top_obs)
ct_td <- tdrec(topf = topbase, m = 12, C = C, weights = props)

`