cov_var_process: Compute the Covariance Matrix of a VAR(p) Process

Description Usage Arguments Details Value Implementation Examples

View source: R/aux_funs.R

Description

Compute the unconditional covariance matrix of the observations y_t.

Usage

1
cov_var_process(A, SIGMA, h = 0, tol = 1e-07)

Arguments

A

A (K x Kp) matrix, providing the coeffcients for lag 1 to p with the first row containing the coefficents of the first equation. Parameter p is the maximum lag length and K the number of variables.

SIGMA

A (K x K) matrix of covariances. The covariance matrix of the residuals U.

h

An integer scalar, the horizon at which to compute the covariances. Defaults to the contemporaneous covariances of y_t.

tol

A numeric scalar, the tolerance level for stopping the computation. See Details.

Details

Computing the covariance matrix invloves an infinite sum. Computation is stopped if the summed differences of the elements of two iterations of the covariance matrix is less than the tolerance level tol.

Value

A (K x K) numeric matrix. It containes the covariances of y_t and y_{t+h}.

Implementation

Plain brute force with no regard for efficiency.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
K <- 4
p <- 2

A <- matrix(0.0, K, K * p)
SIGMA <- matrix(0.5, K, K)
cov_var_process(A, SIGMA)

A <- matrix(-0.2, K, K * p); diag(A) <- 1:K / 10
cov_var_process(A, SIGMA)
cov_var_process(A, SIGMA, h = 5)
cov_var_process(A, SIGMA, h = 150)

nielsaka/zeitreihe documentation built on March 17, 2020, 8:38 p.m.