Learn R Programming

VARsignR (version 0.1.3)

rfbvar: Recursive BVAR with a flat Normal inverted-Wishart prior

Description

Bayesian vector autoregression (BVAR) model with a flat Normal inverted-Wishart prior. Shocks are identified using a Cholesky decomposition.

Usage

rfbvar(Y=NULL, nlags=4, draws=1000, constant=TRUE, steps=24, shock=1)

Arguments

Y
A ts object containing the data series used for estimation; this should be of size $T x nvar$.
nlags
The number of lags to include of each variable. The default value is 4.
draws
An integer value for the number of Markov Chain Monte Carlo (MCMC) sampling replications. The default value is 1000.
constant
A logical statement on whether to include an intercept in the model. The default is 'TRUE'.
steps
An integer value for the horizon of the impulse response calculations. The default value is 24.
shock
An integer value specifiying for which shock the impulse responses are calculated. The number corresponds to the variable ordering in Y. The default value is 1.

Value

A list of the posterior draws, which contains:
IRFS
A $draws x steps x nvar$ array of posterior impulse responses.
FEVDS
A $draws x steps x nvar$ array of posterior forecast error variance decompositions.
SHOCKS
A $draws x (T-nlags)$ array of posterior draws of the model's shocks.
Bdraws
A $draws x nvar$ array of posterior draws of the model coefficients.
Sdraws
A $draws x nvar x nvar$ array of posterior draws of the model's variance-covariance matrix.

Details

This function estimates a BVAR model using a flat Normal inverted-Wishart prior. Shocks are identified using a Cholesky decomposition. The ordering in the decomposition corresponds to the ordering of the variables in $Y$. The size of the shock is one standard deviation. Posterior draws are only returned for the variable specified in shock. In order to get the remaining impulse responses, re-run the model for different values of shock (see example below).

References

Canova, F. (2007), Methods for Applied Macroeconomic Research, Princeton, NJ: Princeton University Press.

See Also

uhlig.reject, uhlig.penalty, rwz.reject, fp.target, irfplot, fevdplot.

Examples

Run this code
## Not run: 
# # Replication of Figure 5 of Uhlig (2005)
# 
# set.seed(12345)
# data(uhligdata)
# 
# # variable labels for plots
# vl <- c("GDP","GDP Deflator","Comm.Pr.Index","Fed Funds Rate",
#         "NB Reserves", "Total Reserves")
# 
# # FED funds rate shock
# model0 <- rfbvar(Y=uhligdata, nlags=12, draws=1000, constant=FALSE,
#                   steps=60, shock=4)
# 
# # plot impulse response functions
# irfplot(irfdraws=model0$IRFS, type="median", labels=vl, save=FALSE, bands=c(0.16, 0.84),
#         grid=TRUE, bw=FALSE)
# ## End(Not run)
 

Run the code above in your browser using DataLab