Learn R Programming

MSBVAR (version 0.9-2)

szbvar: Reduced form Sims-Zha Bayesian VAR model estimation

Description

Estimation of the Bayesian VAR model for just identified VARs described in Sims and Zha (1998)

Usage

szbvar(Y, p, z = NULL, lambda0, lambda1, lambda3, lambda4, lambda5, mu5, mu6, nu = ncol(Y)+1, qm = 4, prior = 0, posterior.fit = FALSE)

Arguments

Y
$T x m$ multiple time series object created with ts().
p
Lag length
z
$T x k$ matrix of exogenous variables. Can be z = NULL if there are none.
lambda0
$[0,1]$, Overall tightness of the prior (discounting of prior scale).
lambda1
$[0,1]$, Standard deviation or tightness of the prior around the AR(1) parameters.
lambda3
Lag decay ($>0$, with 1=harmonic)
lambda4
Standard deviation or tightness around the intercept $>0$
lambda5
Standard deviation or tightness around the exogneous variable coefficients $>0$
mu5
Sum of coefficients prior weight $\ge0$. Larger values imply difference stationarity.
mu6
Dummy initial observations or drift prior $\ge0$. Larger values allow for common trends.
nu
Prior degrees of freedom, $m+1$
qm
Frequency of the data for lag decay equivalence. Default is 4, and a value of 12 will match the lag decay of monthly to quarterly data. Other values have the same effect as "4"
prior
One of three values: 0 = Normal-Wishart prior, 1 = Normal-flat prior, 2 = flat-flat prior (i.e., akin to MLE)
posterior.fit
logical, F = do not estimate log-posterior fit measures, T = estimate log-posterior fit measures.

Value

Returns a list of multiple elements. This is a workhorse function to get the estimates, so nothing is displayed to the screen. The elements of the list are intended as inputs for the various post-estimation functions (e.g., impulse response analyses, forecasting, decompositions of forecast error variance, etc.)Returns a list of the class "BVAR" with the following elements:
intercept
$m x 1$ row vector of the $m$ intercepts
ar.coefs
$m x m x p$ array of the AR coefficients. The first $m x m$ array is for lag 1, the p'th array for lag p.
exog.coefs
$k x m$ matrix of the coefficients for any exogenous variables
Bhat
$(mp + k + 1) x m$ matrix of the coefficients, where the columns correspond to the variables in the VAR
vcv
$m x m$ matrix of the maximum likelihood estimate of the residual covariance
vcv.Bh
Posterior estimate of the parameter covariance that is conformable with Bhat.
mean.S
$m x m$ matrix of the posterior residual covariance.
St
$m x m$ matrix of the degrees of freedom times the posterior residual covariance.
hstar
$(mp + k + 1) x (mp + k + 1)$ prior precision plus right hand side variables crossproduct.
hstarinv
$(mp + k + 1) x (mp + k + 1)$ prior covariance crossproduct solve(hstar)
H0
$(mp + k + 1) x (mp + k + 1)$ prior precision for the parameters
S0
$m x m$ prior error covariance
residuals
$(T-p) x m$ matrix of the residuals
X
$T x (mp + k + 1)$ matrix of right hand side variables for the estimation of BVAR
Y
$T x m$ matrix of the left hand side variables for the estimation of BVAR
y
$T x m$ input data in dat
z
$T xk$ exogenous variables matrix
p
Lag length
num.exog
Number of exogenous variables
qm
Value of parameter to match quarterly to monthly lag decay (4 or 12)
prior.type
Numeric code for prior type: 0 = Normal-Wishart, 1 = Normal-Flat, 2 = Flat-Flat (approximate MLE)
prior
List of the prior parameter: c(lambda0,lambda1,lambda3,lambda4,lambda5, mu5, mu6, nu)
marg.llf
Value of the in-sample marginal log-likelihood for the data, if posterior.fit=T
marg.post
Value of the in-sample marginal log posterior of the data, if posterior.fit=T
coef.post
Value of the marginal log posterior estimate of the coefficients, if posterior.fit=T

Details

This function estimates the Bayesian VAR (BVAR) model described by Sims and Zha (1998). This BVAR model is based a specification of the dynamic simultaneous equation representation of the model. The prior is constructed for the structural parameters. The basic SVAR model used here is documented in szbsvar. The prior covariance matrix of the errors, $S(i)$, is initially estimated using a VAR(p) model via OLS, with an intercept and no demeaning of the data.

References

Sims, C.A. and Tao Zha. 1998. "Bayesian Methods for Dynamic Multivariate Models." International Economic Review. 39(4):949-968. Brandt, Patrick T. and John R. Freeman. 2006. "Advances in Bayesian Time Series Modeling and the Study of Politics: Theory Testing, Forecasting, and Policy Analysis". Political Analysis.

See Also

reduced.form.var szbsvar

Examples

Run this code
  ## Not run: 
#     data(IsraelPalestineConflict)
#     varnames <- colnames(IsraelPalestineConflict)
# 
#     fit.BVAR <- szbvar(IsraelPalestineConflict, p=6, z=NULL,
#                            lambda0=0.6, lambda1=0.1,
#                             lambda3=2, lambda4=0.25, lambda5=0, mu5=0,
#                             mu6=0, nu=3, qm=4,
#                             prior=0, posterior.fit=FALSE)
# 
#     # Draw from the posterior pdf of the impulse responses.
#     posterior.impulses <- mc.irf(fit.BVAR, nsteps=10, draws=5000)
# 
#     # Plot the responses
#     plot(posterior.impulses, method=c("Sims-Zha2"), component=1,
#          probs=c(0.16,0.84), varnames=varnames) 
# ## End(Not run)

Run the code above in your browser using DataLab