irf: Impulse Response Functions

View source: R/irf.R

irfR Documentation

Impulse Response Functions

Description

Computes orthogonalized impulse response functions (IRF) from an RBFM-VAR model with optional bootstrap confidence intervals.

Usage

irf(object, horizon = 20, ortho = TRUE, boot = 0, ci = 90, seed = NULL)

Arguments

object

An rbfmvar object from rbfmvar.

horizon

Integer. Number of periods for the IRF. Default is 20.

ortho

Logical. If TRUE (default), compute orthogonalized IRFs using Cholesky decomposition of the error covariance matrix.

boot

Integer. Number of bootstrap replications for confidence intervals. If 0 (default), no bootstrap is performed.

ci

Numeric. Confidence level for bootstrap intervals (0-100). Default is 90.

seed

Integer. Random seed for reproducibility. Default is NULL.

Details

The IRF measures the response of each variable to a one-standard-deviation shock in each of the structural innovations. When ortho = TRUE, the structural shocks are identified using the Cholesky decomposition of the residual covariance matrix (recursive identification).

Bootstrap confidence intervals are computed using the recursive-design bootstrap following Kilian (1998).

Value

An object of class "rbfmvar_irf" containing:

irf

Array of IRF values (horizon x n x n). Element [h, i, j] is the response of variable i to a shock in variable j at horizon h.

irf_lower

Lower confidence bounds (if bootstrap was performed).

irf_upper

Upper confidence bounds (if bootstrap was performed).

horizon

IRF horizon.

varnames

Variable names.

ortho

Whether orthogonalized IRFs were computed.

boot

Number of bootstrap replications.

ci

Confidence level.

References

Kilian, L. (1998). Small-Sample Confidence Intervals for Impulse Response Functions. Review of Economics and Statistics, 80(2), 218-230. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1162/003465398557465")}

Lutkepohl, H. (2005). New Introduction to Multiple Time Series Analysis. Springer-Verlag. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/978-3-540-27752-1")}

Examples

# Simulate VAR data
set.seed(123)
n <- 200
e <- matrix(rnorm(n * 3), n, 3)
y <- matrix(0, n, 3)
colnames(y) <- c("y1", "y2", "y3")
for (t in 3:n) {
  y[t, ] <- 0.3 * y[t-1, ] + 0.2 * y[t-2, ] + e[t, ]
}

fit <- rbfmvar(y, lags = 2)
ir <- irf(fit, horizon = 20)
plot(ir)

# With bootstrap confidence intervals
ir_boot <- irf(fit, horizon = 20, boot = 500, ci = 95)
plot(ir_boot)


rbfmvar documentation built on April 9, 2026, 9:08 a.m.