| irf | R Documentation |
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.
irf(x, n.ahead=24, shockinfo=NULL, quantiles=NULL,
expert=NULL, verbose=TRUE)
x |
Object of class |
n.ahead |
Forecasting horizon. |
shockinfo |
Dataframe with additional information about the nature of shocks. Depending on the |
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
|
verbose |
If set to |
Returns a list of class bgvar.irf with the following elements:
posteriorFour-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.
shockinfoDataframe 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.
AMedian posterior of global coefficient matrix.
Ginv Median posterior of matrix Ginv, which describes contemporaneous relationships between countries.
SPosterior median of matrix with country variance-covariance matrices on the main diagonal.
Rmed Posterior rotation matrix if ident="sign".
model.objList object that contains model-specific information, in particular
xglobalData of the model.
lagsLag 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.
Maximilian Boeck, Martin Feldkircher, Florian Huber
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.
bgvar, get_shockinfo, add_shockinfo
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=50, burnin=50,
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.