Learn R Programming

bvarsv (version 1.1)

bvar.sv.tvp: Bayesian Analysis of a Vector Autoregressive Model with Stochastic Volatility and Time-Varying Parameters

Description

Bayesian estimation of the flexible VAR model by Primiceri (2005) which allows for both stochastic volatility and time drift in the model parameters.

Usage

bvar.sv.tvp(Y, p = 1, tau = 40, nf = 10, pdrift = TRUE, nrep = 50000, nburn = 5000, thinfac = 10, itprint = 10000, save.parameters = TRUE, k_B = 4, k_A = 4, k_sig = 1, k_Q = 0.01, k_S = 0.1, k_W = 0.01, pQ = NULL, pW = NULL, pS = NULL)

Arguments

Y
Matrix of data, where rows represent time and columns are different variables. Y must have at least two columns.
p
Lag length, greater or equal than 1 (the default)
tau
Length of the training sample used for determining prior parameters via least squares (LS). That is, data in Y[1:tau, ] are used for estimating prior parameters via LS; formal Bayesian analysis is then performed for data in Y[(tau+1):nrow(Y), ].
nf
Number of future time periods for which forecasts are computed (integer, 1 or greater, defaults to 10).
pdrift
Dummy, indicates whether or not to account for parameter drift when simulating forecasts (defaults to TRUE).
nrep
Number of MCMC draws excluding burn-in (defaults to 50000)
nburn
Number of MCMC draws used to initialize the sampler (defaults to 5000). These draws do not enter the computation of posterior moments, forecasts etc.
thinfac
Thinning factor for MCMC output. Defaults to 10, which means that the forecast sequences (fc.mdraws, fc.vdraws, fc.ydraws, see below) contain only every tenth draw of the original sequence. Set thinfac to one to obtain the full MCMC sequence.
itprint
Print every itprint-th iteration. Defaults to 10000. Set to very large value to omit printing altogether.
save.parameters
If set to TRUE, parameter draws are saved in lists (these can be very large). Defaults to TRUE.
k_B, k_A, k_sig, k_Q, k_W, k_S, pQ, pW, pS
Quantities which enter the prior distributions, see the links below for details. Defaults to the exact values used in the original article by Primiceri.

Value

Beta.postmean
Posterior means of coefficients. This is an array of dimension $[M, Mp+1, T]$, where $T$ denotes the number of time periods (= number of rows of Y), and $M$ denotes the number of system variables (= number of columns of Y). The submatrix $[, , t]$ represents the coefficient matrix at time $t$. The intercept vector is stacked in the first column; the p coefficient matrices of dimension $[M,M]$ are placed next to it.
H.postmean
Posterior means of error term covariance matrices. This is an array of dimension $[M, M, T]$. The submatrix $[, , t]$ represents the covariance matrix at time $t$.
Q.postmean, S.postmean, W.postmean
Posterior means of various covariance matrices.
fc.mdraws
Draws for the forecast mean vector at various horizons (three-dimensional array, where the first dimension corresponds to system variables, the second to forecast horizons, and the third to MCMC draws). Note: The third dimension will be equal to nrep/thinfac, apart from possible rounding issues.
fc.vdraws
Draws for the forecast covariance matrix. Design similar to fc.mdraws, except that the first array dimension contains the lower-diagonal elements of the forecast covariance matrix.
fc.ydraws
Simulated future observations. Design analogous to fc.mdraws.
Beta.draws, H.draws
Matrices of parameter draws, can be used for computing impulse responses later on (see impulse.responses), and accessed via the helper function parameter.draws. These outputs are generated only if save.parameters has been set to TRUE.

References

Del Negro, M. and Primicerio, G.E. (2015). `Time Varying Structural Vector Autoregressions and Monetary Policy: A Corrigendum', Review of Economic Studies 82, 1342-1345.

Koop, G. and D. Korobilis (2010): `Bayesian Multivariate Time Series Methods for Empirical Macroeconomics', Foundations and Trends in Econometrics 3, 267-358. Accompanying Matlab code available at https://sites.google.com/site/dimitriskorobilis/matlab.

Primiceri, G.E. (2005): `Time Varying Structural Vector Autoregressions and Monetary Policy', Review of Economic Studies 72, 821-852.

See Also

The helper functions predictive.density and predictive.draws provide simple access to the forecast distribution produced by bvar.sv.tvp. Impulse responses can be computed using impulse.responses. For detailed examples and explanations, see the accompanying pdf file hosted at https://sites.google.com/site/fk83research/code.

Examples

Run this code
## Not run: 
# 
# # Load US macro data
# data(usmacro)
# 
# # Estimate trivariate BVAR using default settings
# set.seed(5813)
# bv <- bvar.sv.tvp(usmacro)
# 
# ## End(Not run)

Run the code above in your browser using DataLab