irf.varx: Impulse Response Functions

View source: R/svarirf.R

irf.varxR Documentation

Impulse Response Functions

Description

Calculates impulse response functions.

Usage

## S3 method for class 'varx'
irf(x, ..., n.ahead = 20, normf = NULL)

Arguments

x

VAR object of class 'varx', 'id', or any other that will be coerced to 'varx'.

...

Currently not used.

n.ahead

Integer. Number of periods to consider after the initial impulse, i.e. the horizon of the IRF.

normf

Function. A given function that normalizes the K \times S input-matrix into an output matrix of same dimension. See the example in id.iv for the normalization of Jentsch and Lunsford (2021) that fixes the size of the impact response.

Value

A list of class 'svarirf' holding the impulse response functions as a 'data.frame'.

References

Luetkepohl, H. (2005): New Introduction to Multiple Time Series Analysis, Springer, 2nd ed.

Jentsch, C., and Lunsford, K. G. (2021): "Asymptotically Valid Bootstrap Inference for Proxy SVARs", Journal of Business and Economic Statistics, 40, pp. 1876-1891.

Examples

data("PCIT")
names_k = c("APITR", "ACITR", "PITB", "CITB", "GOV", "RGDP", "DEBT")
names_l = c("m_PI", "m_CI")  # proxy names
names_s = paste0("epsilon[ ", c("PI", "CI"), " ]")  # shock names
dim_p   = 4  # lag-order

# estimate and identify proxy SVAR #
R.vars = vars::VAR(PCIT[ , names_k], p=dim_p, type="const")
R.idBL = id.iv(R.vars, iv=PCIT[-(1:dim_p), names_l], S2="MR", cov_u="OMEGA")
colnames(R.idBL$B) = names_s  # labeling

# calculate and plot normalized IRF #
R.norm = function(B) B / matrix(-diag(B), nrow(B), ncol(B), byrow=TRUE)
plot(irf(R.idBL, normf=R.norm))


pvars documentation built on Nov. 5, 2025, 6:57 p.m.