szbsvar(Y, p, z = NULL, lambda0, lambda1, lambda3, lambda4, lambda5, mu5, mu6, ident, qm = 4)
ts()
with no NAs.dat
plus the
m dummy observations for dat
c(lambda0,lambda1,lambda3,lambda4,lambda5, mu5, mu6)
. ident
. szbvar
or
reduced.form.var
The basic SVAR model has the form of Waggoner and Zha (2003): $$ y_t^\prime A_0 = \sum_{\ell=1}^p Y_{t-\ell}^\prime A_\ell + z_t^\prime D + \epsilon_t^\prime, t = 1, \ldots, T, $$
where $A(i)$ are $m x m$ parameter matrices for the contemporaneous and lagged effects of the endogenous variables, $D$ is an $h x m$ parameter matrix for the exogenous variables (including an intercept), $y(t)$ is the $m x 1$ matrix of the endogenous variables, $z(t)$ is a $h x 1$ vector of exogenous variables (including an intercept) and $e(t)$ is the $m x 1$ matrix of structural shocks. NOTE that in this representation of the model, the columns of the $A(i)$ matrices refer to the equations!
The structural shocks are normal with mean and variance equal to the following: $$ E[\epsilon_t | y_1, \ldots, y_{t-1}, z_1, \ldots z_{t-1}] = 0$$ $$E[\epsilon_t \epsilon_t^\prime | y_1, \ldots, y_{t-1}, z_1, \ldots z_{t-1}] = I$$
The reduced form representation of the SVAR model can be found by post-multiplying through by $A(0)^{-1}$: $$ y_t^\prime A_0 A_0^{-1} = \sum_{\ell=1}^p Y_{t-\ell}^\prime A_\ell A_0^{-1} + z_t^\prime DA_0^{-1} + \epsilon_t^\prime A_0^{-1}$$
$$y_t^\prime = \sum_{\ell=1}^p Y_{t-\ell}^\prime B_\ell + z_t^\prime \Gamma + \epsilon_t^\prime A_0^{-1}.$$
The reduced form error covariance matrix is found from the crossproduct of the reduced form innovations:
$$ \Sigma = E[(\epsilon_t^\prime A_0^{-1})(\epsilon_t^\prime A_0^{-1})^\prime] = [A_0 A_0^\prime]^{-1}. $$.
Restrictions on the contemporaneous parameters in $A(0)$ are
expressed by the specification of the ident
matrix that defines
the shocks that "hit" each equation in the contemporaneous
specification. If ident
is defined as in the following table,
Equations | ||
Variables | Eqn 1 | |
Eqn 2 | Eqn 3 | Var. 1 |
1 | 0 | 0 |
Var. 2 | 1 | 1 |
0 |
then the corresponding $A(0)$ is restricted to
Equations | ||
Variables | Eqn 1 | |
Eqn 2 | Eqn 3 | Var. 1 |
$a(11)$ | 0 | 0 |
Var. 2 | $a(12)$ | $a(22)$ |
0 |
which is interpreted as shocks in variables 1 and 2 hit equation 1 (the first column); shocks in variables 2 and 3 hit the second equation (column 2); and, shocks in variable 3 hit the third equation (column 3).
As in Sims and Zha (1998) and Waggoner and Zha (2003), the prior for the model is formed for each of the equations. To illustrate the prior, the model is written in the more compact notation
$$ y_t^\prime A_0 = x_t^\prime F + \epsilon_t^\prime$$ where $$ x_t^\prime = [ y_{t-1}^\prime \cdots y_{t-p}^\prime, z_t^\prime], F^\prime = [A_1^\prime \cdots A_p^\prime \, D^\prime] $$ are the matrices of the right hand side variables and the right hand side coefficients for the SVAR model.
The general form of this prior is then $$a_i \sim N(0, \bar{S_i}) \quad \textrm{and} \quad f_i | a_i \sim N(\bar{P}_i a_i, \bar{H}_i)$$
where $S(i)$ is an $m x m$ prior covariance of the contemporaneous parameters, and $H(i)$ is the $k x k$ prior covariance of the parameters in $f(i) | a(i)$. The prior means of $a(i)$ are zero in the structural model, while the "random walk" component is in $P(i) a(i)$.
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.
The Bayesian prior is constructed for the unrestricted VAR model and then mapped into the restricted prior parameter space, as discussed in Waggoner and Zha (2003a).
Waggoner, Daniel F. and Tao A. Zha. 2003a. "A Gibbs sampler for structural vector autoregressions" Journal of Economic Dynamics \& Control. 28:349--366.
Waggoner, Daniel F. and Tao A. Zha. 2003b. "Likelihood preserving normalization in multiple equation models". Journal of Econometrics. 114: 329--347.
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 14(1):1-36.
szbvar
for reduced form Bayesian VAR models,
reduced.form.var
for non-Bayesian reduced form VAR
models, gibbs.A0
for drawing from the
posterior of this model using a Gibbs sampler,
posterior.fit
for assessing the
posterior fit of the model, and mc.irf
for computing impulse responses for this model.
# SZ, B-SVAR model for the Levant data
data(BCFdata)
m <- ncol(Y)
ident <- diag(m)
ident[1,] <- 1
ident[2,1] <- 1
# estimate the model's posterior moments
model <- szbsvar(Y, p=2, z=z2, lambda0=0.8, lambda1=0.1,
lambda3=1, lambda4=0.1, lambda5=0.05,
mu5=0, mu6=5, ident, qm=12)
Run the code above in your browser using DataLab