Wednesday, December 4, 2019

Sign and Zero Restricted VAR Add-In

Authors and guest post by Davaajargal Luvsannyam and Ulziikhutag Munkhtsetseg

In our previous blog entry, we discussed the sign restricted VAR (SRVAR) add-in for EViews. Here, we will discuss imposing a further zero restrictions on the impact period of the impulse response function (IRF) using the ARW and SRVAR add-ins in tandem.

Table of Contents

  1. Introduction
  2. Orthogonal Reduced-Form Parameterization
  3. ARW Algorithms
  4. ARW EViews Add-in
  5. Conclusion
  6. References


Note that it is certainly possible to impose both sign and exclusion restrictions. For example, Mountford and Uhlig (2009) are motivated by the idea that fiscal policy shocks are identified as orthogonal to both monetary policy and business cycle shocks, and use a penalty function approach (PFA) to impose zero restrictions. (For details on the PFA, please see our SRVAR blog entry.) They also considered anticipated government revenue shocks in which government revenue is restricted to rise one year following some impulse. Furthermore, Beaudry, Nam, and Wang (2011) estimate a structural VAR model including total factor productivity, stock prices, real consumption, real federal funds rate and hours worked. They use the PFA to show that a positive optimism shock causes an increase in both consumption and hours worked. Recently, Arias, Rubio-Ramirez, and Waggoner (2018), henceforth ARW, developed algorithms to independently draw from a family of conjugate posterior distributions over the structural parameterization when sign and zero restrictions are used to identify SRVARs. They showed the dangers of using the PFA when implementing sign and zero restrictions together to identify structural VARs (SVARs).

Orthogonal Reduced-Form Parameterization

ARW focus on two SVAR parameterizations. In addition to the classical structural parameterization, they show that SVARs can also be written as a product of a reduced-form parameters and a set of orthogonal matrices. This is called the orthogonal reduced-form parameterization, henceforth, ORF. The algorithms ARW propose draw from a conjugate posterior distribution over the ORF and then transform said draws into a structural parameterization. In particular, they use the normal-inverse-Wishart distribution as the prior conjugate distribution, and develop a change of variable theory that characterizes the induced family of densities over the structural parameterization. This theory shows that a uniform-normal-inverse-Wishart density over the ORF parameterization induces a normal-generalized-normal density over the structural parameterization.

To motivate their contribution, ARW first show that existing algorithms for SVARs identified only by sign restrictions, conditional on a sign restriction using the change of variable theory, operate on independent draws from the normal-generalized-normal distribution over the structural parameterization. These algorithms independently draw from the uniform-normal-inverse-Wishart distribution over the ORF parameterization and only accept draws that impose a sign restriction.

Next, ARW generalize these algorithms to also consider zero restrictions. The key to this generalization is that, conditional on the reduced-form parameters, the class of zero restrictions on the structural parameters maps to linear restrictions on the orthogonal matrices. The resulting approach generalization independently draws from normal-inverse-Wishart over the reduced-form parameters and from the set of orthogonal matrices such that the zero restrictions hold. In this regard, conditional on the zero restrictions, they show that this generalization does not induce a distribution over the structural parameterization from the family of normal-generalized-normal distributions. Furthermore, they derive the induced distribution and write an importance sampler that, conditional on the sign and zero restrictions, independently draws from normal-generalized-normal distributions over the structural parameterization.

To formalize these ideas, consider the SVAR with the general form: \begin{align} Y_t^{\prime} A_{0} = \sum_{i=1}^{p} Y_{t-i}^{\prime}A_{i} + c + \epsilon_t^{\prime}, \quad t=1, \ldots, T \label{eq1} \end{align} where $ Y_t $ is an $ n\times 1 $ vector of endogenous variables, $ A_i $ are parameter matrices of size of $ n\times n $ with $ A_{0} $ invertible, $ c $ is a $ 1\times n $ vector of parameters, $ \epsilon_t $ is an $ n\times 1 $ vector of exogenous structural shocks, $ p $ is the lag length, and $ T $ is the sample size.

We can also summarize equation \eqref{eq1} as follows: \begin{align} Y_{t}^{\prime}A_{0} = X_{t}^{\prime}A_{+} + \epsilon_{t}^{\prime} \label{eq2} \end{align} where $ A_{+}^{\prime} = \left[A_{1}^{\prime}, \ldots, A_{p}^{\prime}, c^{\prime}\right]$ and $ X_{t}^{\prime} = \left[Y_{t-1}^{\prime}, \ldots, Y_{t-p}^{\prime}, 1\right] $.

The reduced form can now be written as: \begin{align} Y_{t}^{\prime} = X_{t}^{\prime}B + u_{t}^{\prime} \label{eq3} \end{align} where $ B = A_{+}A_{0}^{-1}, u_{t}^{\prime} = \epsilon_{t}^{\prime}A_{0}^{-1} $, and $ E(u_{t}u_{t}^{\prime}) = \Sigma = \left(A_{0}A_{0}^{\prime}\right)^{-1} $. Naturally, $ B $ and $ \Sigma $ are the reduced form parameters.

We can further write equation \eqref{eq3} as the orthogonal reduced-form parameterization \begin{align} Y_{t}^{\prime} = X_{t}^{\prime}B + \epsilon_{t}^{\prime}Q^{\prime}h(\Sigma) \label{eq4} \end{align} where the $ n\times n $ matrix $ h(\Sigma) $ is the Cholesky decomposition of covariance matrix $ \Sigma $.

Given equations \eqref{eq2} and \eqref{eq4}, in addition to the Cholesky decomposition $ h $, we can define a mapping between $ \left(A_{0}, A_{+}\right) $ and $ (B, \Sigma, Q) $ by: \begin{align} f_{h}\left(A_{0}, A_{+}\right) = \left(A_{+}A_{0}^{-1}, \left(A_{0}A_{0}^{\prime}\right)^{-1}, h\left(\left(A_{0}A_{0}^{\prime}\right)^{-1}\right)A_{0}\right) \label{eq5} \end{align} where the first element of the triad on the right corresponds to $ B $, the second to $ \Sigma $, and the third to $ Q $.

Note further that the function $ f_{h} $ is invertible with inverse defined by: \begin{align} f_{h}^{-1} (B,\Sigma, Q) = \left(h(\Sigma)^{-1}Q, Bh(\Sigma)^{-1}Q\right) \label{eq6} \end{align} where the first term on the right corresponds to $ A_{0} $ and the second to $ A_{+} $.

Thus, the ORF parameterization makes clear how the structural parameters depend on the reduced form parameters and orthogonal matrices.

ARW Algorithms

Although ARW propose three different algorithms, the most important is in fact the third. The latter draws from a distribution over the ORF parameterization conditional on the sign and zero restriction and then transforms the draws into the structural parameterization. Since Algorithm 3 also depends on Algorithm 2, we present the latter here and recommend readers to refer to the supplementary materials of ARW (2018) if they require further details.

Algorithm 2

Let $ Z_j $ define the zero restriction matrix on the $ j^{\text{th}} $ structural shock, and let $ z_{j} $ denote the number of zero restrictions associated with the $ j^{\text{th}} $ structural shock. Then:
  1. Draw $ (B, \Sigma) $ independently from Normal-inverse-Wishart distribution.
  2. For $ j \in \{1, \ldots, n\} $ draw $ X_{j} \in \mathbf{R}^{n+1-j-Z_{j}} $ independently from a standard normal distribution and set $ W_{j} = X_{j} / ||X_{j}||$.
  3. Define $ Q = [q_{1}, \ldots q_{n}] $ recursively as $ q_{j} = K_{j}W_{j} $ for any matrix $ K_{j} $ whose columns form an orthonormal basis for the null space of the $ (j-1+z_{j})\times n $ matrix \begin{align} M_{j} = \left[q_{1}, \ldots, q_{j-1},\left(Z_{j}F\left(f_{h}^{-1}(B, \Sigma, I_{n})\right)\right)\right] \end{align}
  4. Set $ (A_{0},A_{+}) = f_{h}^{-1}(B,\Sigma,Q) $.

Algorithm 3

Let $ \mathcal{Z} $ denote the set of all structural parameters that satisfy the zero restrictions, and define $ v_{(g^{\circ}f_{h})|\mathcal{Z}} $ as te volume element. Then:
  1. Use Algorithm 2 to independently draw $ (A_{0}, A_{+}) $.
  2. If $ (A_{0}, A_{+}) $ satisfies the sign restrictions, set its importance weight to $$ \frac{|\det(A_{0})|^{-(2n+m+1)}}{v_{(g^{\circ}f_{h})|\mathcal{Z}}(A_{0}A_{+})} $$ otherwise, set its importance weight to zero.
  3. Return to Step 1 until the required number of draws has been obtained.
  4. Re-sample with replacement using the importance weights.

ARW EViews Add-in

Now we turn to the implementation of the ARW add-in. First, we need to download and install the add-in from the EViews website. The latter can be found at We can also do this from inside EViews itself. In particular, after opening EViews, click on Add-ins from the main menu, and click on Download Add-ins.... From here, locate the ARW add-in and click on Install.

Figure 1: Add-in installation

After installing, we open the data file named as data.WF1 which can be found in the installation folder, typically located in [Windows User Folder]/Documents/EViews Addins/ARW.

Figure 2: ARW (2018) Data

We now replicate Figures 1 and Table 3 from ARW. We can of course do this in EViews as follows.

  1. Click on the Add-ins menu item in the main EViews menu, and click on Sign restricted VAR.
  2. Under Endogenous variables enter tfp stock cons ffr hour.
  3. Check the Include constant option.
  4. Under Number of lags, enter 4.
  5. In the Sign restriction vector textbox enter +2.
  6. Under Sign restriction method check Penalty.
  7. In the Number of horizons enter 40
  8. Under Zero restriction textbox enter tfp.
  9. Check the variance decomposition box.
  10. Hit OK.

Figure 3: SRVAR Add-in (PFA)

The steps above produce the following output (Panel A of Figure 1 of ARW):

Figure 4: PFA Output

Next, we invoke the ARW add-in and proceed with the ARW Algorithm 3.

  1. Click on the Add-ins menu item in the main EViews menu, and click on Sign and zero restricted VAR.
  2. Under Endogenous variables enter tfp stock cons ffr hour.
  3. Check the Include constant option.
  4. Under Number of lags, enter 4.
  5. In the Sign restriction vector textbox enter +stock.
  6. In the Zero restrictions textbox enter tfp.
  7. UnderNumber of steps enter 40.
  8. Check the variance decomposition box.
  9. Hit OK.

Figure 5: ARW Add-in (Importance Sampler)

The steps above produce the following output (Panel B of Figure 1 of ARW):

Figure 6: Importance Sampler Output

Figures 5 and 6 above illustrates the IRFs using the PFA and importance sampler methods, respectively. In case of the former, we can see the IRFs with probability bands for adjusted TFP, stock prices, consumption, real interest rate,and hours worked under the PFA. Examining the confidence bands around IRFs allows us to conclude that optimism shocks boost consumption and hours worked, as the corresponding IRFs do not contain a zero for at least 20 quarters.

Alternatively, the IRFs of the same variables obtained using the importance sampler yield a different result. For consumption and hours worked, the confidence bands are wider and contain zero. Furthermore, the corresponding point-wise median IRFs are closer to zero compared to those obtained using the PFA. This shows that the PFA exaggerates the effects of optimism shocks on stock prices, consumption, and hours worked, by generating much narrower confidence bands and larger point-wise median IRFs. In this regard, as pointed out by Uhlig (2005), we can see that the PFA includes additional identification restrictions when implementing sign and zero restrictions.

To further summarize the results, we present the table below which gives the specifics of the output figures above.

Penalty Function Approach Importance Sampler
Adjusted TFP 0.07 0.17 0.29 0.03 0.11 0.23
Stock Prices 0.54 0.72 0.84 0.05 0.29 0.57
Consumption 0.13 0.27 0.43 0.03 0.17 0.50
Real Interest Rate 0.07 0.14 0.23 0.08 0.20 0.39
Hours Worked 0.20 0.31 0.45 0.04 0.18 0.56
Table I: Forecast Error Variance Decomposition (FEVD)

Table I shows the contribution of shocks to the Forecast Error Variance Decomposition (FEVD) using the PFA and the importance sampler for the chosen horizon of 40 periods and 68 percent equal-tailed probability intervals. Under the PFA, the share of FEVD attributable to optimism shocks of consumption and hours worked is 27 and 31 percent, respectively. However, the contribution of optimism shocks to the FEVD of stock prices is 72 percent under the PFA in contrast to 29 percent using the importance sampler. It should be noted that for most variables, when using the importance sampler, optimism shocks contribute less to the FEVD, and probability intervals for the FEVD are broader as opposed to those obtained under the PFA.


In this blog entry we presented the ARW add-in for EViews. The add-in is based on the work of ARW (2018) and generates impulse response curves based on the importance sampler which accommodates both sign and zero restrictions in the VAR model.


  1. Arias J., Rubio-Ramirez J., and Waggoner D.: Inference Based on SVARs Identified with Sign and Zero Restrictions: Theory and Applications Econometrica, 86:685–720, 2018.
  2. Beaudry P., Nam D., and Wang J.: Do mood swing drive business cycle and is it rational? NBER Working Paper 17651, 2011.
  3. Mountford A. and Uhlig H.: What are the effects of fiscal policy shocks? Journal of Applied Econometrics, 24:960–992, 2009.
  4. Uhlig H.: What are the effects of monetary policy on output? Results from an agnostic identification procedure. Journal of Monetary Economics, 52(2):381–419, 2005.


  1. Greeting Sir,
    I was trying to replicate ARW as show in figure 5 above but it was giving an error message saying "@RIWISH is illegal or reserved name".
    Please, what can I do to resolve the problem.
    Thank you.

    1. Hello, I have the same error. Is there a fix about that?

  2. Thanks for your work. It is very interesting to read the opinion and analysis of the professionals.

  3. Hello, I would like to enquire the Same Question. When I estimated the ARW model, the notification "@IRIWISH is illegal or reserved name" always appears. What should I do then?

  4. Hi and thanks for this useful add-in. However, I cant get it to work (using Eviews13): I get the error message "Error 72 in encrypted program" using ARW and "Error 247in encrypted program" using the earlier SRVAR add-in. It used to work with Eviews12 so I wonder whether this has anything to do with that?