MA_coeffs: Moving Average Coefficients

Description Usage Arguments Details Value Examples

View source: R/VAR-2-estimation.R

Description

Compute moving average coefficient of a VAR up to horizon h given its autoregressive coefficients. Particularly useful for computing impulse response functions.

Usage

1
MA_coeffs(A, h)

Arguments

A

A numeric matrix, the autoregressive coefficients of the VAR process. Can either be of dimension K x Kp or Kp x Kp.

h

An integer scalar, the horizon.

Details

The input matrix A can be either in horizontally stacked format or companion matrix format. In the former case the dimension is K x Kp where K is the number of variables and p is the lag length. In that case A = [A_1, A_2, ..., A_p]. Alternatively, matrix A can be in companion matrix format. See companion_format() for details.

Value

An array of dimension (K x K x h+1) with the matrix of moving average coefficients at horizon i stored as element [, , i].

Examples

1
2
3
4
5
data("Canada", package = "vars")
BETA <- zeitreihe::ols_mv(Y = t(Canada), p = 2)$BETA.hat
# drop intercept
IRFs <- zeitreihe::MA_coeffs(A = BETA[, -1], h = 4)
IRFs

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