When working with a general linearly constrained multiple (\(n\)-variate) time series (\(\mathbf{x}_t\)), getting a linear combination matrix \(\bar{\mathbf{C}}\) is a critical step to obtain a structural-like representation such that, for \(t = 1, ..., T\), \[\bar{\mathbf{U}}'= [\mathbf{I} \quad -\bar{\mathbf{C}}] \quad \Rightarrow \quad \mathbf{y}_t = \mathbf{P}\mathbf{x}_t = \left[\begin{array}{c} \mathbf{v}_t\cr \mathbf{f}_t \end{array}\right] = \left[\begin{array}{c} \mathbf{\bar{\mathbf{C}}}\cr \mathbf{I} \end{array}\right]\mathbf{f}_t = \mathbf{\bar{\mathbf{S}}}\mathbf{f}_t,\] where \(\bar{\mathbf{U}}'\) is the (\(n_v \times n\)) full rank zero constraints matrix, \(\bar{\mathbf{S}}\) is the (\(n \times n_f\)) matrix analogous of the summing matrix \(\mathbf{S}\) for a genuine hierarchical/groupped times series, \(\bar{\mathbf{C}}\) is the (\(n_v \times n_f\)) linear combination matrix such that \(\mathbf{v}_t = \bar{\mathbf{C}}\mathbf{f}_t\), \(\mathbf{v}_t\) is the (\(n_v \times 1\)) vector of ‘basic’ variables, and \(\mathbf{f}_t\) is the (\(n_f \times 1\)) vector of ‘free’ variables (Di Fonzo and Girolimetto, 2022).

lcmat(Gt, alg = "rref", tol = sqrt(.Machine$double.eps),
       verbose = FALSE, sparse = TRUE)

Arguments

Gt

(\(r \times n\)) coefficient matrix (\(\mathbf{\Gamma}'\)) for a general linearly constrained multiple time series (\(\mathbf{x}_t\)) such that \(\mathbf{\Gamma}'\mathbf{x}_t = \mathbf{0}_{(r \times 1)}\).

alg

Technique used to trasform \(\mathbf{\Gamma}'\) in \(\bar{\mathbf{U}}' = [\mathbf{I} \quad -\bar{\mathbf{C}}]\), such that \(\bar{\mathbf{U}'}\mathbf{y}_t = \mathbf{0}_{(n_v \times 1)}\). Use "rref" for the Row Reduced Echelon Form through Gauss-Jordan elimination (default), or "qr" for the (pivoting) QR decomposition (Strang, 2019).

tol

Tolerance for the "rref" or "qr" algorithm.

verbose

If TRUE, intermediate steps are printed (default is FALSE).

sparse

Option to return a sparse \(\bar{\mathbf{C}}\) matrix (default is TRUE).

Value

A list with

Cbar

(\(n_v \times n_f\)) linear combination matrix \(\bar{\mathbf{C}}\)

pivot

(\(n \times 1\)) vector of the column permutations s.t. \(\mathbf{P} = \mathbf{I}[,\mbox{pivot}]\)

Details

Looking for an analogous of the summing matrix \(\mathbf{S}\), say \(\bar{\mathbf{S}} = \left[\begin{array}{c} \mathbf{\bar{\mathbf{C}}}\cr \mathbf{I} \end{array}\right]\), the lcmat function transforms \(\mathbf{\Gamma}'\) into \(\bar{\mathbf{U}}' = [\mathbf{I} \quad -\bar{\mathbf{C}}]\), such that \(\bar{\mathbf{U}}'\mathbf{y}_t = \mathbf{0}_{(n_v \times 1)}\). Consider the simple example of a linearly constrained multiple time series consisting of two hierarchies, each with distinct bottom time series, with a common top-level series (\(X\)): \[\begin{array}{l} 1)\; X = C + D,\cr 2)\; X = A + B, \cr 3)\; A = A1 + A2. \end{array}\] The coefficient matrix \(\mathbf{\Gamma}'\) of the linear system \(\mathbf{\Gamma}'\mathbf{x}_t=\mathbf{0}\) (\(\mathbf{x}_t = [X\; C\; D\; A\; B\; A1\; A2]\)) is \[\mathbf{\Gamma}' = \left[\begin{array}{ccccccc} 1 & -1 & -1 & 0 & 0 & 0 & 0 \cr 1 & 0 & 0 & -1 & -1 & 0 & 0 \cr 0 & 0 & 0 & 1 & 0 & -1 & -1 \end{array}\right].\] The lcmat function returns \[\bar{\mathbf{C}} = \left[\begin{array}{cccc} 0 & 1 & 1 & 1 \cr -1 & 1 & 1 & 1 \cr 0 & 0 & -1 & -1 \end{array}\right].\] Then \[\bar{\mathbf{U}}' = \left[\begin{array}{ccc|cccc} 1 & 0 & 0 & 0 & -1 & -1 & -1 \cr 0 & 1 & 0 & 1 & -1 & -1 & -1 \cr 0 & 0 & 1 & 0 & 0 & 1 & 1 \end{array}\right], \quad \mbox{with} \quad \bar{\mathbf{U}}'\mathbf{y}_t = \bar{\mathbf{U}}' \left[\begin{array}{c} \mathbf{v}_t \cr \mathbf{f}_t \end{array}\right] = \mathbf{0},\] where \(\mathbf{v}_t = [X\; C\; A]\), and \(\mathbf{f}_t = [D\; B\; A1\; A2]\).

References

Di Fonzo, T., Girolimetto, D. (2022), Point and probabilistic forecast reconciliation for general linearly constrained multiple time series (mimeo).

Strang, G., (2019), Linear algebra and learning from data, Wellesley, Cambridge Press.

Examples

Gt <- matrix(c(1,-1,-1,0,0,0,0,
               1,0,0,-1,-1,0,0,
               0,0,0,1,0,-1,-1), nrow = 3, byrow = TRUE)
Cbar <- lcmat(Gt = Gt)$Cbar
P <- diag(1, NCOL(Gt))[,lcmat(Gt = Gt)$pivot]