Learn R Programming

pvars (version 1.1.1)

irf.pvarx: Impulse Response Functions for panel SVAR models

Description

Calculates impulse response functions for panel VAR objects.

Usage

# S3 method for pvarx
irf(x, ..., n.ahead = 20, normf = NULL, w = NULL, MG_IRF = TRUE)

Value

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

Arguments

x

Panel VAR object of class 'pid' or 'pvarx' or a list of VAR objects 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.

w

Numeric, logical, or character vector. \(N\) numeric elements weighting the individual coefficients, or names or \(N\) logical elements selecting a subset from the individuals \(i = 1, \ldots, N\) for the MG estimation. If NULL (the default), all \(N\) individuals are included without weights.

MG_IRF

Logical. If TRUE (the default), the mean-group of individual IRF is calculated in accordance with Gambacorta et al. (2014). If FALSE, the IRF is calculated for the mean-group of individual VAR estimates.

References

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

Gambacorta L., Hofmann B., and Peersman G. (2014): "The Effectiveness of Unconventional Monetary Policy at the Zero Lower Bound: A Cross-Country Analysis", Journal of Money, Credit and Banking, 46, pp. 615-642.

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

Run this code
data("PCAP")
names_k = c("g", "k", "l", "y")  # variable names
names_i = levels(PCAP$id_i)      # country names
L.data  = sapply(names_i, FUN=function(i) 
  ts(PCAP[PCAP$id_i==i, names_k], start=1960, end=2019, frequency=1), 
  simplify=FALSE)

# estimate and identify panel SVAR #
L.vars = lapply(L.data, FUN=function(x) vars::VAR(x, p=2, type="both"))
R.pid  = pid.chol(L.vars, order_k=names_k)

# calculate and plot MG-IRF #
library("ggplot2")
R.irf = irf(R.pid, n.ahead=60)
F.irf = plot(R.irf, selection=list(2:4, 1:2))
as.pplot(F.irf=F.irf, color_g="black", n.rows=3)$F.plot + guides(color="none")

Run the code above in your browser using DataLab