Theoretical reminder
Consider the order p
VAR representation for the 1\times m
vector of observed variables y_t
:
y_{t}=\mathbf C+\sum_{k=1}^{p} y_{tk} \mathbf{A}_{k} + u_t
where u_t\sim \mathcal N\left( 0,\Sigma_u\right)
. Let z_t
be the (mp+1)\times 1
vector \left[1,y_{t1}',...,y_{tp}'\right]'
and define \mathbf{A}=\left[\mathbf C', \mathbf A_1',...,\mathbf A_p'\right]'
, the VAR representation can then be written in matrix form as:
Y=Z\mathbf A +\mathcal U
where Y = (y_1',\ldots,y_T')'
, Z = (z_1',\ldots,z_T')'
and \mathcal U = (u_1',\ldots,u_T')'
.
Dummy observations prior for the VAR can be constructed using the VAR likelihood function for \mathcal T = [\lambda T]
artificial data simulated with the DSGE \left( Y^{\ast },Z^{\ast}\right)
, combined with diffuse priors (see Tiao and Zellner (1962) or Zellner (1971)). The prior is then given by:
p_{0}\left( \mathbf A, \Sigma \mid Y^*,Z^* \right)
\propto
\left\vert \Sigma \right\vert ^{\frac{\lambda T+m+1}{2}}e^{\frac{1}{2}tr\left[ \Sigma^{1}\left(
{Y^*}'Y^*\mathbf{A}'{Z^*}'Y^*{Y^*}'Z^*\mathbf A+ \mathbf A'{Z^*}'Z^*\mathbf A \right) \right] }
implying that \Sigma
follows an inverted Wishart distribution and \mathbf A
conditional on \Sigma
is Gaussian. Assuming that observables are covariance stationary, Del Negro and Schorfheide use the DSGE theoretical autocovariance matrices for a given n\times 1
vector of model parameters \theta
, denoted \Gamma_{YY}\left( \theta \right)
, \Gamma_{ZY}\left( \theta \right)
,
\Gamma_{YZ}\left( \theta\right)
, \Gamma_{ZZ}\left( \theta \right)
instead of the (artificial) sample moments {Y^*}'Y^*
, {Z^*}'Y^*
, {Y^*}'Z^*
, {Z^*}'Z^*
. In addition, the p
th order VAR approximation of the DSGE provides the first moment of the prior distributions through the population leastsquare regression:
\begin{array}{ll}
\mathrm A^*( \theta ) = \Gamma_{ZZ}\left( \theta\right)^{1}\Gamma_{ZY}\left( \theta \right) & \qquad\qquad\textrm{(P1a)}\\
\Sigma^*(\theta) = \Gamma_{YY}(\theta) \Gamma_{YZ}(\theta)\Gamma_{ZZ}\left( \theta \right)^{1}\Gamma_{ZY}\left( \theta \right) & \qquad\qquad\textrm{(P1b)}
\end{array}
Conditional on the deep parameters of the DSGE \theta
and \lambda
, the priors for the VAR parameters are given by:
\mathrm{vec} \mathbf A \mid \Sigma ,\theta, \lambda \sim \mathcal N \left(\mathrm{vec}\mathbf A^*(\theta),\Sigma
\otimes \left[\lambda T \Gamma_{ZZ}(\theta)\right]^{1}\right)
\Sigma \mid \theta,\lambda \sim \mathcal{IW}\left(\lambda T \Sigma^*(\theta),\lambda
Tmpm\right)\qquad \textrm{(P2)}
where \Gamma_{ZZ}(\theta)
is assumed to be non singular and \lambda \geq \frac{mp+m}{T}
for the priors to be proper. The a priori density of \mathbf A
is defined by n+1
parameters (\theta
and \lambda
), which is likely to be less than m^2p
(the VAR number of parameters). If we have a onetoone relationship (no identification issues) between (\theta,\lambda)
and \mathbf A
it will be a good idea to estimate (\theta,\lambda)
instead of \mathbf A
, ie to estimate fewer free parameters. To do so, Del Negro and Schorfheide complete the prior by specifying a prior distribution over the structural model's deep parameters:
p_0(\theta)
. We still have to set the weight of the structural prior, \lambda
. Del Negro and Schorfheide choose the value of \lambda
that maximizes the marginal density. They estimate a limited number of DSGEVAR models, say N
models, with different values of \lambda
. For each model they also estimate the marginal density and select the model (ie the value of \lambda
) with highest marginal density. Implicitly, they compare different models considering a (discrete) uniform prior distribution over the collection of N
models. With Dynare it is also possible to estimate \lambda
as another parameter, instead of doing a loop over the values of this parameter. So we define a prior on \lambda
, which is assumed to be independent from \theta
.
Finally, the DSGEVAR model has the following prior structure:
p_0\left( \mathbf A,\Sigma, \theta, \lambda \right) = p_0\left(
\mathbf A, \Sigma \mid \theta ,\lambda \right) \times
p_0\left( \theta \right) \times p_0\left( \lambda \right)\qquad\textrm{(P3)}
where p_0\left(\mathbf A, \Sigma \mid \theta ,\lambda \right)
is defined by (P1a,P1b) and (P2).
The posterior distribution, may be factorized in the following way:
p\left( \mathbf A, \Sigma , \theta , \lambda \mid \mathcal Y_T\right) = p\left(\mathbf A, \Sigma
\mid \mathcal Y_T, \theta, \lambda\right) \times
p\left( \theta ,\lambda \mid \mathcal Y_T\right)\qquad\textrm{(Q3)}
where \mathcal Y_T
stands for the sample. A closed form expression for the first density function on the right hand side of (Q3) is available. Conditional on \theta
and \lambda
, (P1a,P1b) and (P2) define a conjugate prior for the VAR model, so its posterior density belongs to the same family: the distribution of \mathbf A
conditional on \Sigma
, \theta
, \lambda
and the sample is matricvariate normal, and the distribution of \Sigma
conditional on \theta
, \lambda
and the sample is inverted Wishart. More formally, we have:
\begin{array}{ll}
\mathrm{vec} \mathbf A \mid \Sigma, \theta , \lambda, \mathcal Y_T
\sim \mathcal N \left(\mathrm{vec}\widetilde{\mathbf A}(\theta,\lambda),\Sigma \otimes
V(\theta,\lambda)^{1}\right) & \qquad\qquad\textrm{(Q2a)}\\
\Sigma \mid \theta, \lambda, \mathcal Y_T \sim
\mathcal{IW} \left( (\lambda+1) T~\widetilde{\Sigma}(\theta,\lambda),(\lambda+1)Tmpm\right) & \qquad\qquad\textrm{(Q2b)}
\end{array}
where:
\begin{array}{ll}
\widetilde{\mathbf A}(\theta,\lambda) = V(\theta,\lambda)^{1}\left( \lambda T~\Gamma_{ZY}(\theta)+Z'Y\right)
& \qquad\qquad\textrm{(Q1a)}\\
\widetilde{\Sigma}(\theta,\lambda) = \frac{1}{(1+\lambda)T}
\left[ \lambda T~\Gamma_{YY}(\theta) + Y'Y  \left(\lambda T~\Gamma _{YZ}(\theta)
+Y'Z\right) V(\theta,\lambda)^{1}\left(
\lambda T~\Gamma_{ZY}(\theta)+Z'Y\right)\right] & \qquad\qquad\textrm{(Q1b)}
\end{array}
with:
V(\theta,\lambda) = \lambda T~\Gamma_{ZZ}(\theta) +Z'Z
The posterior mean of \mathbf A
is a convex combination of A^*(\theta)
, the prior mean, and of the OLS estimate of \mathbf A
. When \lambda
goes to infinity the posterior mean shrinks towards the prior mean, ie the projection of the DSGE model onto the VAR(p
). We do not have a closed form expression for the joint posterior density of \theta
and \lambda
(the second term on the right hand side of (Q3)). So the posterior distribution of (\theta,\lambda)
is recovered from an MCMC algorithm, as described in Del Negro and Schorfheide, except that we do estimate \lambda
jointly with the deep parameters \theta
.
Estimation of a DSGEVAR model with Dynare
Up to version 4.1.x
The estimation of a DSGEVAR model instead of a DSGE model is triggered by using the keyword dsge_prior_weight
in the list of declared parameters. This parameter name is the Dynare word for \lambda
. If dsge_prior_weight
is a parameter, Dynare understands that the user wants to estimate a DSGEVAR model using the DSGE model declared in the same file as a prior for a VAR model. The number of lags is four by default and can be changed by adding, for instance, the following line of code:
options_.varlag = 12;
before the estimation
command. The weight of the DSGE prior can be:
 Calibrated to a positive real number (greater than
\frac{mp+m}{T}
) or toInf
(\lambda=\infty
case).  Estimated jointly with the deep parameters. In this case, a prior density has to be defined in the
estimated_params
block with the usual syntax. An example where the estimation of\lambda
is implemented is given in Adjemian DarracqPariès and Moyen (2008).
Version 4.2.x and following
The estimation of a DSGEVAR model instead of a DSGE model is triggered by using the keyword dsge_var
in the estimation
command. If the weight of the DSGE prior is calibrated (as in Del Negro and Schorfheide (2004)) the calibrated value for \lambda
must be supplied to the estimation
command as follows:
estimation(..., dsge_var = 1.4, ...);
The DSGE prior weight has to be a real positive number or plus infinity. If the weight of the DSGE prior is estimated (as in Adjemian, DarracqPariès, and Moyen (2008)), the prior of \lambda
must be defined in the estimated_params
block, as follows:
estimated_params;
...
dsge_prior_weight, uniform_pdf, , , 0, 2;
...
end;
estimation(..., dsge_var, ...);
The number of lags of the VAR model is four by default and can be changed by using the option dsge_varlag
in the estimation
command, for instance:
estimation(..., dsge_var, dsge_varlag=12, ...);
Example
Up to version 4.1.x
First run the file simul_hybrid.mod to create a data set from a new keynesian model with an hybrid Phillips curve. Second run the file bvar_forward.mod to estimate the DSGEVAR model (where the DSGE prior is a new keynesian model with an hybrid Phillips curve). The second file is self documented.
Version 4.2.x and following
Examples are in the tests directory of the (git) master repository here.
References

Adjemian, S., DarracqPariès, M. and S. Moyen (2008). Towards a monetary policy evaluation framework. ECB Working paper 942

Del Negro, M., and F. Schorfheide (2004). Priors from General Equilibrium Models for VARs, in International Economic Review, 45(2), 643–673.

Del Negro, M., F. Schorfheide, F. Smets, and R. Wouters (2007). On the Fit of New Keynesian Models, in Journal of Business and Economic Statistics, 25(2), 123162.

Tiao, G. C., and A. Zellner (1964). Bayes Theorem and the Use of Prior Knowledge in Regression Analysis, Biometrika, 51(162), 219–230.

Zellner, A. (1971). An Introduction to Bayesian Inference in Econometrics. John Wiley & Sons.