Impulse Response Function
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, ident="chol", shockinfo=NULL, quantiles=NULL,
expert=NULL, verbose=TRUE)x |
Object of class |
n.ahead |
Forecasting horizon. |
ident |
Character defining type of identification scheme. Default |
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:
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.
ident Character showing the chosen identification scheme.
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.
plag 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.
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.
oldpar <- par(no.readonly = TRUE)
# First example, a US monetary policy shock, quarterly data
library(BGVAR)
data(eerDatasmall)
# US monetary policy shock
model.eer<-bgvar(Data=eerDatasmall, W=W.trade0012.small, draws=100, burnin=100,
plag=1, prior="SSVS", eigen=TRUE)
# define shock
shockinfo <- get_shockinfo("chol")
shockinfo$shock <- "US.stir"; shockinfo$scale <- -100
# generalized impulse responses
irf.girf.us.mp<-irf(model.eer, n.ahead=24, ident="girf", shockinfo=shockinfo)
# cholesky identification
irf.chol.us.mp<-irf(model.eer, n.ahead=24, ident="chol", 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, ident="sign", 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=24, ident="sign", shockinfo=shockinfo)
# Example with zero restriction (Arias et al., 2018) and
# rationality conditions (D'Amico and King, 2017).
data("eerDataspf")
model.eer<-bgvar(Data=eerDataspf, W=W.trade0012.spf, draws=300, burnin=300,
plag=1, prior="SSVS", eigen=TRUE)
shockinfo <- get_shockinfo("sign")
shockinfo <- add_shockinfo(shockinfo, shock="US.stir_t+4",
restriction=c("US.Dp_t+4","US.stir","US.y_t+4"),
sign=c("<","0","<"), horizon=1, prob=1, scale=1)
# rationality condition: US.stir_t+4 on impact is equal to average of
# IRF of US.stir between horizon 1 to 4
shockinfo <- add_shockinfo(shockinfo, shock="US.stir_t+4", restriction="US.stir_t+4",
sign="ratio.avg", horizon=5, prob=1, scale=1)
# rationality condition: US.Dp_t+4 on impact is equal to IRF of US.Dp at horizon 4
shockinfo <- add_shockinfo(shockinfo, shock="US.stir_t+4", restriction="US.Dp_t+4",
sign="ratio.H", horizon=5, prob=1, scale=1)
# rationality condition: US.y_t+4 on impact is equal to IRF of US.y at horizon 4
shockinfo <- add_shockinfo(shockinfo, shock="US.stir_t+4", restriction="US.y_t+4",
sign="ratio.H", horizon=5, prob=1, scale=1)
# regulate maximum number of tries with expert settings
irf.ratio <- irf(model.eer, n.ahead=20, ident="sign", shockinfo=shockinfo,
expert=list(MaxTries=10))Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.