Learn R Programming

BGVAR (version 2.0.0)

IRF.cf: Counterfactual Analysis

Description

Function to perform counterfactual analysis. It enables to neutralize the response of a specific variable to a given shock.

Usage

IRF.cf(obj,shockvar,resp,nhor=24,save.store=FALSE,verbose=TRUE)

Arguments

obj

an object of class bgvar.

shockvar

structural shock of interest.

resp

response variable to neutralize.

nhor

forecasting horizon.

save.store

If set to TRUE the full posterior is returned. Default is set to FALSE in order to save storage.

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 is a four-dimensional array (K times K times nhor times 7) that contains 7 quantiles of the posterior distribution of the impulse response functions: the 50% ("low25" and "high75"), the 68% ("low16" and "high84") and the 90% ("low05" and "high95") credible sets along with the posterior median ("median").

  • struc.obj is a 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.

  • model.obj is a list object that contains model-specific information, in particular

    • xglobal used data of the model.

    • plag used lag specification of the model.

  • IRF_store is a four-dimensional array (K times nhor times nr. of shock times saves) which stores the whole posterior distribution. Exists only if save.irf.store=TRUE.

Examples

Run this code
# NOT RUN {
library(BGVAR)
data(eerData)
model.ssvs.eer<-bgvar(Data=eerData,W=W.trade0012,saves=100,burns=100,plag=1,prior="SSVS",
                      eigen=TRUE)
# }
# NOT RUN {
# very time-consuming
# }
# NOT RUN {
irf.cf <- IRF.cf(model.ssvs.eer,shockvar="US.stir",resp="US.rer",nhor=24)
# }

Run the code above in your browser using DataLab