| as_tevector | R Documentation |
These functions convert matrix between the two canonical layouts used in
temporal reconciliation.
Let m be the maximum temporal aggregation order and k^\ast the sum
of a subset of the (p-1) proper factors of m (excluding m);
let h be the forecast horizon for the lowest frequency series (e.g.,
most aggregated temporal forecast horizon):
Horizon-stacked layout (temporal version): a
h \times (k^\ast + m) matrix where rows are the most aggregated temporal
forecast horizons, and the values in each row are ordered from the lowest frequency
(most temporally aggregated) to the highest frequency.
Temporal layout: a (h(k^\ast + m) \times 1) numeric vector where
values are ordered from the lowest frequency (most temporally aggregated) to the
highest frequency.
Then, as_tevector converts a (h \times (k^\ast+m))
horizon-stacked matrix to a (h(k^\ast + m) \times 1) temporal vector;
as_hstack_telayout performs the inverse transform.
as_tevector(hmat, agg_order)
as_hstack_telayout(tevec, agg_order)
hmat |
A |
agg_order |
Highest available sampling frequency per seasonal cycle
(max. order of temporal aggregation, |
tevec |
A ( |
as_tevector returns a (h(k^\ast + m) \times 1) numeric vector
in temporal layout.
as_hstack_telayout returns a h \times (k^\ast+m) numeric
matrix in horizon-stacked layout (temporal version).
Utilities:
FoReco2matrix(),
aggts(),
as_ctmatrix(),
balance_hierarchy(),
commat(),
csprojmat(),
cstools(),
ctprojmat(),
cttools(),
df2aggmat(),
lcmat(),
recoinfo(),
res2matrix(),
set_bounds(),
shrink_estim(),
shrink_oasd(),
teprojmat(),
tetools(),
unbalance_hierarchy()
h <- 2 # horizons
m <- 4 # temporal aggregation order
kt <- tetools(m)$dim["kt"]
# Build a horizon-stacked matrix: h rows, n * k_t columns
input_te <- seq_len(h * kt)
hmat <- as_hstack_telayout(input_te, agg_order = m)
tevec <- as_tevector(hmat, agg_order = m)
# all.equal(tevec, input_te, check.attributes = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.