The #VectorAutoRegression stuff I've been doing can be summarized as
$$ y_t = \sum_{i=1}^p A_i y_{t - i} $$
where each $y_t$ is a $D$-vector and each $A_i$ is a $D \times D$ matrix.
Given an input series of $y$ values, the $A_i$ can be calculated by #LeastSquares minimization:
$$
Y = [ y_p ; y_1; \ldots ; y_{T - 1} ] \\
X = [ y_{p-1}, y_{p-2}, \ldots, y_0 ; y_p, y_{p-1}, \ldots, y_1 ; \ldots ; y_{T-2}, y_{T-3}, \ldots, y_{T-1 - p} ] \\
A = \left(X^T X\right)^{-1} X^T Y
$$
where the matrices have these initial dimensions:
Y : (T - p) × D
X : (T - p) × (p × D)
A : (p × D) × D
then reshape $A$ to $p × (D × D)$
In my case all values are complex (and ^T is conjugate transpose) because each $y$ is an FFT of a block of input data - I'm using FFT size $256$ (making $D = 129 = 256/2+1$ unique bins for real input) overlapped 4x.
#VectorAutoRegression #LeastSquares