| coherent_smat | R Documentation |
Constructs the n \times n_b structural matrix \mathbf{S} for a
set of linearly related time series, where n is the total number
of series and n_b is the number of bottom-level series.
coherent_smat(data, sparse = FALSE)
data |
A data object which contains linearly related coherent structures. |
sparse |
If |
Let \boldsymbol{b}_t be the n_b-vector of bottom-level series at
time t, and \boldsymbol{a}_t = \mathbf{A}\boldsymbol{b}_t be the
n_a = n - n_b aggregated series, where \mathbf{A} is the
n_a \times n_b aggregation matrix. The full n-vector of series is
\boldsymbol{y}_t = [\boldsymbol{a}_t', \boldsymbol{b}_t']', and the
structural matrix satisfies
\boldsymbol{y}_t = \mathbf{S}\boldsymbol{b}_t, \quad
\mathbf{S} = \begin{bmatrix} \mathbf{A} \\ \mathbf{I}_{n_b} \end{bmatrix}.
Any linear reconciliation method can be written as
\tilde{\boldsymbol{y}}_h = \mathbf{S}\mathbf{G}\hat{\boldsymbol{y}}_h,
where \hat{\boldsymbol{y}}_h are the h-step base forecasts.
Optimal reconciled forecasts use
\mathbf{G} = (\mathbf{S}'\mathbf{W}^{-1}\mathbf{S})^{-1}\mathbf{S}'\mathbf{W}^{-1},
with \mathbf{W} a positive definite weight matrix (see
min_trace()).
An n \times n_b matrix (dense or sparse) encoding the
structural relationships among all series.
Hyndman, R. J., & Athanasopoulos, G. (2022). Notation for forecast reconciliation. https://robjhyndman.com/hyndsight/reconciliation-notation.html
coherent_cmat() for the corresponding zero-constraint matrix
\mathbf{C} and aggregate_key() for computing cross-sectional
aggregations with tsibble data sets.
tsibble::tourism %>%
aggregate_key(Purpose, Trips = sum(Trips)) %>%
coherent_smat()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.