Cross-temporal bottom-up reconciliation — ctbu (original) (raw)
Cross-temporal bottom-up reconciled forecasts for all series at any temporal aggregation level are computed by appropriate summation of the high-frequency bottom base forecasts \(\widehat{\mathbf{B}^{[1]}}\): \widetilde{\mathbf{X}} = \mathbf{S}_{cs}\widehat{\mathbf{B}^{[1]}}\mathbf{S}'_{te},$$ where \(\mathbf{S}_{cs}\) and \(\mathbf{S}_{te}\) are the cross-sectional and temporal structural matrices, respectively.
Usage
ctbu(base, agg_mat, agg_order, tew = "sum", sntz = FALSE)
Arguments
base
A (\(n_b \times hm\)) numeric matrix containing high-frequency bottom base forecasts; \(n_b\) is the total number of high-frequency bottom variables, \(m\) is the max aggregation order, and \(h\) is the forecast horizon for the lowest frequency time series.
agg_mat
A (\(n_a \times n_b\)) numeric matrix representing the cross-sectional aggregation matrix. It maps the \(n_b\) bottom-level (free) variables into the \(n_a\) upper (constrained) variables.
agg_order
Highest available sampling frequency per seasonal cycle (max. order of temporal aggregation, \(m\)), or a vector representing a subset of \(p\) factors of \(m\).
tew
A string specifying the type of temporal aggregation. Options include: "sum
" (simple summation, default), "avg
" (average), "first
" (first value of the period), and "last
" (last value of the period).
sntz
If TRUE
, the negative base forecasts are set to zero before applying bottom-up.
Value
A (\(n \times h(k^\ast+m)\)) numeric matrix of cross-temporal reconciled forecasts.
See also
Examples
set.seed(123)
# Aggregation matrix for Z = X + Y
A <- t(c(1,1))
# (2 x 4) high frequency bottom base forecasts matrix (simulated),
# agg_order = 4 (annual-quarterly)
hfbts <- matrix(rnorm(4*2, 2.5), 2, 4)
reco <- ctbu(base = hfbts, agg_mat = A, agg_order = 4)
# Non negative reconciliation
hfbts[1,4] <- -hfbts[1,4] # Making negative one of the quarterly base forecasts for variable X
nnreco <- ctbu(base = hfbts, agg_mat = A, agg_order = 4, sntz = TRUE)