irf {BGVAR}R Documentation

Impulse Response Function

Description

This function calculates three alternative ways of dynamic responses, namely generalized impulse response functions (GIRFs) as in Pesaran and Shin (1998), orthogonalized impulse response functions using a Cholesky decomposition and finally impulse response functions given a set of user-specified sign restrictions.

Usage

irf(x, n.ahead=24, shockinfo=NULL, quantiles=NULL, 
    expert=NULL, verbose=TRUE)

Arguments

x

Object of class bgvar.

n.ahead

Forecasting horizon.

shockinfo

Dataframe with additional information about the nature of shocks. Depending on the ident argument, the dataframe has to be specified differently. In order to get a dummy version for each identification scheme use get_shockinfo.

quantiles

Numeric vector with posterior quantiles. Default is set to compute median along with 68%/80%/90% confidence intervals.

expert

Expert settings, must be provided as list. Default is set to NULL.

MaxTries

Numeric specifying maximal number of tries for finding a rotation matrix with sign-restrictions. Attention: setting this number very large may results in very long computational times. Default is set to MaxTries=100.

save.store

If set to TRUE the full posterior of both, impulses responses and rotation matrices, are returned. Default is set to FALSE in order to save storage.

use_R

Boolean whether IRF computation should fall back on R version, otherwise Rcpp version is used.

applyfun

In case use_R=TRUE, this allows for user-specific apply function, which has to have the same interface than lapply. If cores=NULL then lapply is used, if set to a numeric either parallel::parLapply() is used on Windows platforms and parallel::mclapply() on non-Windows platforms.

cores

Numeric specifying the number of cores which should be used, also all and half is possible. By default only one core is used.

verbose

If set to FALSE it suppresses printing messages to the console.

Value

Returns a list of class bgvar.irf with the following elements:

posterior

Four-dimensional array (K times n.ahead times number of shocks times Q) that contains Q quantiles of the posterior distribution of the impulse response functions.

shockinfo

Dataframe with details on identification specification.

rot.nr

In case identification is based on sign restrictions (i.e., ident="sign"), this provides the number of rotation matrices found for the number of posterior draws (save*save_thin).

struc.obj

List object that contains posterior quantitites needed when calculating historical decomposition and structural errors via hd.decomp.

A

Median posterior of global coefficient matrix.

Ginv

Median posterior of matrix Ginv, which describes contemporaneous relationships between countries.

S

Posterior median of matrix with country variance-covariance matrices on the main diagonal.

Rmed

Posterior rotation matrix if ident="sign".

model.obj

List object that contains model-specific information, in particular

xglobal

Data of the model.

lags

Lag specification of the model.

IRF_store

Four-dimensional array (K times n.ahead times number of shock times draws) which stores the whole posterior distribution. Exists only if save.store=TRUE.

R_store

Three-dimensional array (K times K times draws) which stores all rotation matrices. Exists only if save.store=TRUE.

Author(s)

Maximilian Boeck, Martin Feldkircher, Florian Huber

References

Arias, J.E., Rubio-Ramirez, J.F, and D.F. Waggoner (2018) Inference Based on SVARs Identified with Sign and Zero Restrictions: Theory and Applications. Econometrica Vol. 86(2), pp. 685-720.

D'Amico, S. and T. B. King (2017) What Does Anticipated Monetary Policy Do? Federal Reserve Bank of Chicago Working paper series, Nr. 2015-10.

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

See Also

bgvar, get_shockinfo, add_shockinfo

Examples

oldpar <- par(no.readonly = TRUE)
# First example, a US monetary policy shock, quarterly data
library(BGVAR)
data(testdata)
# US monetary policy shock
model.eer<-bgvar(Data=testdata, W=W.test, draws=100, burnin=100, 
                 plag=1, prior="SSVS", eigen=TRUE)

# generalized impulse responses
shockinfo<-get_shockinfo("girf")
shockinfo$shock<-"US.stir"; shockinfo$scale<--100

irf.girf.us.mp<-irf(model.eer, n.ahead=24, shockinfo=shockinfo)

# cholesky identification
shockinfo<-get_shockinfo("chol")
shockinfo$shock<-"US.stir"; shockinfo$scale<--100

irf.chol.us.mp<-irf(model.eer, n.ahead=24, shockinfo=shockinfo)

# sign restrictions
shockinfo <- get_shockinfo("sign")
shockinfo <- add_shockinfo(shockinfo, shock="US.stir", restriction=c("US.y","US.Dp"), 
                           sign=c("<","<"), horizon=c(1,1), scale=1, prob=1)
irf.sign.us.mp<-irf(model.eer, n.ahead=24, shockinfo=shockinfo)


# sign restrictions
shockinfo <- get_shockinfo("sign")
shockinfo <- add_shockinfo(shockinfo, shock="US.stir", restriction=c("US.y","US.Dp"), 
sign=c("<","<"), horizon=c(1,1), scale=1, prob=1)
irf.sign.us.mp<-irf(model.eer, n.ahead=24, shockinfo=shockinfo)

#' # sign restrictions with relaxed cross-country restrictions
shockinfo <- get_shockinfo("sign")
# restriction for other countries holds to 75\%
shockinfo <- add_shockinfo(shockinfo, shock="US.stir", restriction=c("US.y","EA.y","UK.y"), 
                           sign=c("<","<","<"), horizon=1, scale=1, prob=c(1,0.75,0.75))
shockinfo <- add_shockinfo(shockinfo, shock="US.stir", restriction=c("US.Dp","EA.Dp","UK.Dp"),
                           sign=c("<","<","<"), horizon=1, scale=1, prob=c(1,0.75,0.75))
irf.sign.us.mp<-irf(model.eer, n.ahead=20, shockinfo=shockinfo)


[Package BGVAR version 2.5.7 Index]