compute_irf: Compute impulse response functions under recursive (Cholesky)...

View source: R/irf.R

compute_irfR Documentation

Compute impulse response functions under recursive (Cholesky) identification

Description

Computes structural impulse responses from an estimated pvarife_result using a recursive (lower-triangular Cholesky) identification scheme. The identification follows the short-run restriction approach of Tugan (2021).

Usage

compute_irf(
  fit,
  n_periods,
  shock = 1L,
  diff_vars = integer(0),
  identification = c("short_run", "long_run"),
  bias_correct = FALSE
)

Arguments

fit

An object of class "pvarife_result".

n_periods

Positive integer. Number of IRF horizons to compute.

shock

Positive integer. Index of the structural shock (1 = first variable in the ordering). Default is 1.

diff_vars

Integer vector. Indices of variables for which cumulative IRFs are reported (e.g., for variables entered in first differences). Default is integer(0) (no cumulation). For long-run identification diff_vars = 1L is common when variable 1 is treated as I(1).

identification

Character. Either "short_run" (default, Cholesky of \hat\Sigma) or "long_run" (Blanchard-Quah: long-run multiplier lower-triangular). See Details.

bias_correct

Logical. If TRUE, the IRF is evaluated at the bias-corrected coefficient vector \hat\beta - \hat b from asymptotic_var. Default FALSE (faster; use irf_bands for full bias-corrected inference).

Details

The MA representation is computed recursively:

B_0 = I_K, \quad B_h = \sum_{l=1}^{\ell} \Theta_l B_{h-l},

with the convention B_j = 0 for j < 0.

Short-run identification (default): The impact matrix is the lower-triangular Cholesky factor of \hat\Sigma: A_0 = \mathrm{chol}(\hat\Sigma)^\top.

Long-run identification (Blanchard-Quah type): The long-run multiplier C(1) = (I - \sum_\ell \Theta_\ell)^{-1} A_0 is constrained to be lower-triangular. The impact matrix is

A_0 = (I - \Theta)\,\mathrm{chol}(D)^\top,

where \Theta = \sum_{\ell=1}^{L} \Theta_\ell and D = (I - \Theta)^{-1} \hat\Sigma (I - \Theta)^{-\top}. This identification restricts shock 1 to have no long-run effect on variable 2 (in a 2-variable system). Faithful to IRs_to_Shocks_LR_Identification.m in the Monte Carlo replication code.

Bias correction: When bias_correct = TRUE, the impact matrix is evaluated at the bias-corrected coefficient vector \hat\beta - \hat b from asymptotic_var. The uncorrected estimator is used by default (bias_correct = FALSE) for speed; users who need confidence bands can rely on irf_bands, whose median is already implicitly bias-corrected.

The impulse response to shock s at horizon h is B_h A_0 e_s where e_s is the s-th standard basis vector.

Value

A matrix of dimension K \times n\_periods. Row k gives the response of variable k to the structural shock at horizons 1, \ldots, n\_periods. The object has class c("pvarife_irf", "matrix").

References

Tugan, M. (2021). Panel VAR models with interactive fixed effects. Econometrics Journal, 24, 225–246. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/ectj/utaa021")}

See Also

irf_bands, bootstrap_irf_bands

Examples

sim <- sim_pvarife(n_units = 30, n_time = 20, n_vars = 2,
                   n_lags = 1, n_factors = 1, seed = 1)
fit <- pvarife(sim$y, n_lags = 1, n_factors = 1, n_out = 5, n_in = 3)
ir  <- compute_irf(fit, n_periods = 8)
dim(ir)   # 2 x 8

# Long-run identification
ir_lr <- compute_irf(fit, n_periods = 8, identification = "long_run",
                     diff_vars = 1L)


pvarife documentation built on June 11, 2026, 5:08 p.m.