autocov_VAR1: Compute the autocovariance matrix for a VAR(1) process.

View source: R/autocov_VAR1.R

autocov_VAR1R 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 A of the autoregression term.

Sigma

Covariance matrix \bm{\Sigma} of the errors.

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)


holans/ST-COS documentation built on Aug. 28, 2023, 5:50 a.m.