autocov_VAR1 {stcos} | R Documentation |
Compute the autocovariance matrix for a VAR(1) process.
Description
Compute the autocovariance matrix for a VAR(1) process.
Usage
autocov_VAR1(A, Sigma, lag_max)
Arguments
A |
Coefficient matrix |
Sigma |
Covariance matrix |
lag_max |
maximum number of lags to compute. |
Details
Computes the autocovariance matrix \bm{\Gamma}(h)
of the
m
-dimensional VAR(1) process
\bm{Y}_t = \bm{A} \bm{Y}_{t-1} + \bm{\epsilon}_t, \quad
\bm{\epsilon}_t \sim \textrm{N}(\bm{0}, \bm{\Sigma})
For the required computation of \bm{\Gamma}(0)
, this function
solves the m^2 \times m^2
system
\textrm{vec}(\bm{\Gamma}(0)) = [\bm{I} - \bm{A} \otimes \bm{A}]^{-1} \textrm{vec}(\bm{\Sigma}).
without directly computing m^2 \times m^2
matrices.
Value
An array Gamma
of dimension c(m, m, lag_max + 1)
,
where the slice Gamma[,,h]
represents the autocovariance at lag
h = 0, 1, ..., lag_max
.
Examples
U = matrix(NA, 3, 3)
U[,1] = c(1, 1, 1) / sqrt(3)
U[,2] = c(1, 0, -1) / sqrt(2)
U[,3] = c(0, 1, -1) / sqrt(2)
B = U %*% diag(c(0.5, 0.2, 0.1)) %*% t(U)
A = (B + t(B)) / 2
Sigma = diag(x = 2, nrow = 3)
autocov_VAR1(A, Sigma, lag_max = 5)