Skip to contents

Compute Wold Impulse Response Functions for VAR Model

Usage

fwoldIRF(fVAR, horizon)

Arguments

fVAR

A list containing VAR estimation results with elements:

  • beta: Coefficient matrix

  • c: Integer indicator for intercept (1 if intercept, 0 otherwise)

  • p: Integer lag order

  • n_exog: Number of exogenous variables (optional)

horizon

Integer, the IRF horizon (number of periods ahead)

Value

A 3D array (cube) of Wold impulse response functions with dimensions N x N x (horizon+1), where irfwold[,,h] contains the response at horizon h

Details

This function computes the Wold (reduced-form) impulse response functions for a VAR(p) model with optional exogenous variables by calculating powers of the companion matrix. The Wold IRF shows the effect of a one-unit shock to each variable on all variables in the system over time, without imposing any identifying restrictions.

Exogenous variables do not contribute to the dynamic propagation of shocks and are therefore excluded from the companion matrix representation.

The IRFs are computed as: $$\Phi_h = A^h[1:N, 1:N]$$ where A is the companion matrix and h is the horizon.

Examples

if (FALSE) { # \dontrun{
# VAR(2) model with 3 variables and 1 exogenous variable
y <- matrix(rnorm(200), ncol = 2)
exog <- matrix(rnorm(100), ncol = 1)
VAR <- fVAR(y, p = 2, c = 1, exog = exog)
irf <- fwoldIRF(VAR, horizon = 10)
# irf is a 2x2x11 array

# Plot impulse response
plot(irf[1, 2, ], type = "l", 
     main = "Response of Variable 2 to Shock in Variable 1")
} # }