girfCompute#

Purpose#

Compute generalized impulse response functions (Pesaran & Shin 1998).

Format#

girf = girfCompute(result, n_ahead)#
Parameters:
  • result (struct) – an instance of a varResult or bvarResult structure.

  • n_ahead (scalar) – number of horizons to compute.

  • var_names (Mx1 string array) – Optional keyword, override variable names.

  • quiet (scalar) – Optional keyword, set to 1 to suppress printed output. Default = 0.

Returns:

girf (struct) –

An instance of an irfResult structure with ident = "generalized" containing:

irf.irf

Array of (n_ahead+1) mxm matrices. irf.irf[h+1] is the mxm impulse response matrix at horizon h. Element [i, j] is the response of variable i to a one-standard-deviation shock to variable j. Index 1 is the impact response (h=0).

irf.n_ahead

Scalar, number of horizons computed.

irf.m

Scalar, number of variables.

irf.var_names

Mx1 string array, variable names.

irf.ident

String, identification method: "cholesky" or "generalized".

Examples#

new;
library timeseries;

data = loadd(getGAUSSHome("pkgs/timeseries/examples/macro.dat"));
result = varFit(data, 4);

// Generalized IRF — invariant to variable ordering
girf = girfCompute(result, 20);

Compare Cholesky and Generalized#

new;
library timeseries;

data = loadd(getGAUSSHome("pkgs/timeseries/examples/macro.dat"));
result = varFit(data, 4);

irf = irfCompute(result, 20, quiet=1);
girf = girfCompute(result, 20, quiet=1);

// For variable 1's own shock, Cholesky and GIRF are identical
print "Cholesky GDP→GDP h=5:" irf.irf[6, 1, 1];
print "GIRF    GDP→GDP h=5:" girf.irf[6, 1, 1];

// For cross-variable responses, they differ
print "Cholesky FFR→GDP h=5:" irf.irf[6, 1, 3];
print "GIRF    FFR→GDP h=5:" girf.irf[6, 1, 3];

Remarks#

Generalized IRFs do not require a causal ordering and are invariant to the ordering of variables in the data. They measure the response to a shock of one standard deviation to variable j, integrating out the effects of other shocks using the historical error covariance.

Key difference from Cholesky IRF: GIRF shocks are not orthogonal. The GIRF to a shock in variable j accounts for the typical contemporaneous correlation with other variables, rather than isolating a pure structural shock. This means GIRF variance decompositions do not sum to 1.

When to use GIRF vs Cholesky:

  • Use Cholesky when you have a defensible recursive ordering (e.g., monetary policy VAR with slow/fast variable classification).

  • Use GIRF when no ordering is defensible, or as a robustness check against ordering sensitivity.

  • Use sign/zero restrictions (SVAR) for theory-driven non-recursive identification.

Model#

The generalized IRF (Pesaran & Shin 1998) for a shock to variable \(j\) is:

\[\text{GIRF}_j(h) = \frac{\Phi_h \Sigma e_j}{\sqrt{\Sigma_{jj}}}\]

where \(\Phi_h = J F^h J'\) is the reduced-form IRF, \(\Sigma\) is the error covariance, and \(e_j\) is the j-th unit vector. The denominator normalizes to a one-standard-deviation shock.

Unlike Cholesky IRF, the GIRF accounts for the typical contemporaneous correlation structure rather than imposing orthogonality. The result is invariant to variable ordering.

Important caveat: GIRF shocks are correlated, so the GIRF-based FEVD does not sum to 1. Use Cholesky (irfCompute()) or sign-restricted SVAR (svarIdentify()) for a proper variance decomposition.

Algorithm#

  1. Compute reduced-form IRF matrices \(\Phi_0, \ldots, \Phi_h\) from the companion form.

  2. For each variable \(j\), scale by \(\Sigma e_j / \sqrt{\Sigma_{jj}}\).

Complexity: Same as irfCompute().

Verification#

GIRF verified against the analytical relationship with Cholesky IRF: for the first variable, GIRF and Cholesky IRF are identical (both equal \(\Phi_h P e_1\)). Tested on the R benchmark data.

References#

  • Pesaran, M.H. and Y. Shin (1998). “Generalized impulse response analysis in linear multivariate models.” Economics Letters, 58(1), 17-29.

Library#

timeseries

Source#

irf.src