Some useful tools for the cross-temporal forecast reconciliation of a linearly constrained (e.g., hierarchical/grouped) multiple time series.
cttools(agg_mat, cons_mat, agg_order, tew = "sum", fh = 1, sparse = TRUE)A list with four elements:
A vector containing information about the number of series for the
complete system (n), for upper levels (na) and bottom level
(nb), the maximum aggregation order (m), the number of factor
(p), the partial (ks) and total sum (kt) of factors.
The vector of the temporal aggregation orders (in decreasing order).
The cross-temporal aggregation matrix.
The cross-temporal structural matrix.
The cross-temporal zero constraints matrix.
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.
A (\(n_a \times n\)) numeric matrix representing the cross-sectional zero constraints: each row represents a constraint equation, and each column represents a variable. The matrix can be of full rank, meaning the rows are linearly independent, but this is not a strict requirement, as the function allows for redundancy in the constraints.
Highest available sampling frequency per seasonal cycle (max. order of temporal aggregation, \(m\)), or a vector representing a subset of \(p\) factors of \(m\).
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).
Forecast horizon for the lowest frequency (most temporally aggregated)
time series (default is 1).
Option to return sparse matrices (default is TRUE).
Cross-temporal framework:
ctboot(),
ctbu(),
ctcov(),
ctlcc(),
ctmo(),
ctrec(),
cttd(),
iterec(),
tcsrec()
Utilities:
FoReco2matrix(),
aggts(),
balance_hierarchy(),
commat(),
csprojmat(),
cstools(),
ctprojmat(),
df2aggmat(),
lcmat(),
recoinfo(),
res2matrix(),
set_bounds(),
shrink_estim(),
shrink_oasd(),
teprojmat(),
tetools(),
unbalance_hierarchy()
# Cross-temporal framework
A <- t(c(1,1)) # Aggregation matrix for Z = X + Y
m <- 4 # from quarterly to annual temporal aggregation
cttools(agg_mat = A, agg_order = m)
Run the code above in your browser using DataLab