Monday, October 14, 2019

Sign Restricted VAR Add-In

Authors and guest post by Davaajargal Luvsannyam and Ulziikhutag Munkhtsetseg

Nowadays, sign restricted VARs (SRVARs) are becoming popular and can be considered as an indispensable tool for macroeconomic analysis. They have been used for macroeconomic policy analysis when investigating the sources of business cycle fluctuations and providing a benchmark against which modern dynamic macroeconomic theories are evaluated. Traditional structural VARs are identified with the exclusion restriction which is sometimes difficult to justify by economic theory. In contrast, SRVARs can easily identify structural shocks since in many cases, economic theory only offers guidance on the sign of structural impulse responses on impact.

Table of Contents

  1. Introduction
  2. Bayesian Inference of SRVARs
  3. Recovering Structural Shocks from an SRVAR
  4. RSVAR EViews Add-in
  5. Conclusion
  6. References

Introduction

Following the seminal work of Uhlig (2005), the uniform-normal-inverse-Wishart posterior over the orthogonal reduced-form parameterization has been dominant for SRVARs. 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. In particular, They show the dangers of using penalty function approaches (PFA) when implementing sign and zero restrictions to identify structural VARs (SVARs). In this blog, we describe the SRVAR add-in based on Uhlig (2005).

The main difference between a classic VAR and a sign restricted VAR is interpretation. For traditional structural VARs (SVARs), there is a unique point estimate of the structural impulse response function. Because sign restrictions represent inequality restrictions, sign restricted VARs are only set identified. In other words, the data are potentially consistent with a wide range of structural models that are all admissible in that they satisfy the identifying restrictions.

There have been both frequentist and Bayesian approaches to summarizing estimates of the admissible set of sign-identified structural VAR models. However, the most common approach for sign restricted VARs is based on Bayesian methods of inference. For example, Uhlig (2005) used a Bayesian approach which is computationally simple and a clean way of drawing error bands for impulse responses.

Bayesian Inference of SRVARs

A typical VAR model is summarized by \begin{align} Y_t = B_1 Y_{t-1} + B_2 Y_{t-2} + \cdots + B_l Y_{t-l} + u_t, \quad t=1, \ldots, T \label{eq1} \end{align} where $ Y_t $ is an $ m\times 1 $ vector of data, $ B_i $ are coefficient matrices of size of $ m\times m $, and $ u_t $ is the one-step ahead prediction error with variance covariance matrix $ \mathbf{\Sigma} $. An intercept and a time trend is also sometimes added to \eqref{eq1}.

Next, stack the system in \eqref{eq1} as follows: \begin{align} \mathbf{Y} = \mathbf{XB} + \mathbf{u} \label{eq2} \end{align} where $ \mathbf{Y} = [Y_{1}, \ldots, Y_{T}]^{\prime} $, $ \mathbf{X} = [X_{1}, \ldots, X_{T}]^{\prime} $ and $ X_{t} = [Y_{t-1}^{\prime}, \ldots, Y_{t-l}^{\prime}] $, $ \mathbf{u} = [u_{1}, \ldots, u_{T}]^{\prime} $, and $ \mathbf{B} = [B_{1}, \ldots, B_{l}]^{\prime} $. It is also assumed that the $ u_{t} $'s are independent and normally distributed with covariance matrix $ \mathbf{\Sigma} $.

Model \eqref{eq2} is typically estimated using maximum likelihood (ML) estimation. In particular, the ML estimates of $ \left(\mathbf{B}, \mathbf{\Sigma}\right) $ is given by: \begin{align} \widehat{\mathbf{B}} &= \left(\mathbf{X}^{\prime}\mathbf{X}\right)^{-1}\mathbf{X}^{\prime}\mathbf{Y} \label{eq3} \\ \widehat{\mathbf{\Sigma}} &= \frac{1}{T}\left(\mathbf{Y} - \mathbf{X}\widehat{\mathbf{B}}\right)^{\prime}\left(\mathbf{Y} - \mathbf{X}\widehat{\mathbf{B}}\right) \label{eq4} \end{align} Next, note that a proper Wishart distribution of $ \left(\mathbf{B}, \mathbf{\Sigma}\right) $ centered around $ \left(\bar{\mathbf{B}}, \mathbf{S}\right) $, is characterized by the mean coefficient matrix $ \bar{\mathbf{B}} $, a positive definite mean covariance matrix $ \mathbf{S} $ along with an additional positive definite matrix $ \mathbf{N} $ of size $ ml \times ml $, and a degrees-of-freedom parameter $ v \geq 0 $. In this regard, Uhlig (2005) consider the priors and posterior for $ \left(\mathbf{B}, \mathbf{\Sigma}\right) $ to belong to the Normal-Wishart family $ W\left(\mathbf{S}^{-1} / v, v\right) $, with $ E\left(\mathbf{\Sigma}^{-1}\right) = \mathbf{S}^{-1} $, whereas the columnwise vectorized form of the coefficient matrix, $ vec\left(\mathbf{B}\right) $, conditional on $ \mathbf{\Sigma} $, is assumed to follow the Normal distribution $ \mathcal{N}\left(vec\left(\bar{\mathbf{B}}\right), \mathbf{\Sigma} \bigotimes N^{-1}\right) $.

Furthermore, Proposition A.1 in Uhlig (1994) shows that if the prior is characterized by the set of parameters $ \left(\bar{\mathbf{B}}_{0}, \mathbf{S}_{0}, \mathbf{N}_{0}, v_{0}\right) $, the posterior is then parameterized by the set $ \left(\bar{\mathbf{B}}_{T}, \mathbf{S}_{T}, \mathbf{N}_{T}, v_{T}\right) $ where: \begin{align} v_{T} &= T + v_{0} \label{eq5} \\ \mathbf{N}_{T} &= \mathbf{N}_{0} + \mathbf{X}^{\prime}\mathbf{X} \label{eq6} \\ \bar{B}_{T} &= \mathbf{N}_{T}^{-1} \left(\mathbf{N}_{0}\bar{\mathbf{B}}_{0} + \mathbf{X}^{\prime}\mathbf{X}\widehat{\mathbf{B}}\right) \label{eq7} \\ \mathbf{S}_{T} &= \frac{v_{0}}{v_{T}}\mathbf{S}_{0} + \frac{T}{v_{T}}\widehat{\mathbf{\Sigma}} + \frac{1}{v_{T}}\left(\widehat{\mathbf{B}} - \bar{\mathbf{B}}_{0}\right)^{\prime}\mathbf{N}_{0}\mathbf{N}_{T}^{-1}\left(\widehat{\mathbf{B}} - \bar{\mathbf{B}}_{0}\right) \label{eq8} \end{align} For instance, in the case of a flat prior with $ \bar{\mathbf{B}}_{0} $ and $ \mathbf{S}_{0} $ arbitrary and $ \mathbf{N}_{0} = v_{0} = 0 $, Uhlig (2005) show that $ \bar{\mathbf{B}}_{T} = \widehat{\mathbf{B}}, \mathbf{S}_{T} = \widehat{\mathbf{\Sigma}}, \mathbf{N}_{T} = \mathbf{X}^{\prime}\mathbf{X}, $ and $ v_{T} = T $.

Recovering Structural Shocks from an SRVAR

Here we consider two approaches to recovering the structural shocks from an SRVAR. The first is based on what's known as the rejection method. In particular, the latter consists of the following algorithmic steps:
  1. Run an unrestricted VAR in order to get $ \widehat{\mathbf{B}} $ and $ \widehat{\mathbf{\Sigma}} $.
  2. Randomly draw $ \bar{\mathbf{B}}_{T} $ and $ \mathbf{S}_{T} $ from the posterior distributions.
  3. Extract the orthogonal innovations from the model using a Cholesky decomposition.
  4. Calculate the resulting impulse responses from Step 3.
  5. Randomly draw an orthogonal impulse vector $ \mathbf{\alpha} $.
  6. Multiply the responses from Step 4 by $ \mathbf{\alpha} $ and check if they match the imposed signs.
  7. If yes, keep the response. If not, drop the draw.
Note here that a draw $ \mathbf{\alpha} $ from an $ m $-dimensional unit sphere is easily obtained drawing $ \widetilde{\mathbf{\alpha}} $ from an $ m $-dimensional standard normal distribution and then normalizing its length to unity. In other words, $ \mathbf{\alpha} = \widetilde{\mathbf{\alpha}} / ||\widetilde{\mathbf{\alpha}}||$.

The second approach, proposed in Uhlig (2005), is called the penalty function method. In particular, the latter proposes the minimization of a penalty function given by: \begin{align} b(x) = \begin{cases} x &\quad \text{if } x \leq 0\\ 100 x &\quad \text{if } x > 0 \end{cases} \end{align} which penalizes positive responses in linear proportion, and rewards negative responses in linear proportion, albeit at a slope 100 times smaller than those on positive sides.

The steps involved in this algorithm can be summarized as follows:
  1. Run an unrestricted VAR in order to get $ \widehat{\mathbf{B}} $ and $ \widehat{\mathbf{\Sigma}} $.
  2. Randomly draw $ \bar{\mathbf{B}}_{T} $ and $ \mathbf{S}_{T} $ from the posterior distributions.
  3. Extract the orthogonal innovations from the model using a Cholesky decomposition.
  4. Calculate the resulting impulse responses from Step 3.
  5. Minimize the penalty function with respect to an orthogonal impulse vector $ \mathbf{\alpha} $.
  6. Multiply the responses from Step 4 by $ \mathbf{\alpha}.$
Now, let $ r_{(j, \mathbf{\alpha})}(k) $ denote the response of variable $ j $ at step $ k $ to the impulse vector $ \mathbf{\alpha} $. Then the underlying minimization problem can be written as follows: \begin{align} \min_{\mathbf{\alpha}} \mathbf{\Psi}(\mathbf{\alpha}) = \sum_{j \in J}\sum_{k \in K}b\left(l_{j}\frac{r_{(j, \mathbf{\alpha})}(k)}{\sigma_{j}}\right) \end{align} To treat the signs equally, let $ l_j=-1 $ if the sign of restriction is positive and $ l_j=1 $ if the sign of restriction is negative. Scaling the variables is done by taking the standard errors, $ \sigma_{j} $ of the first differences of the variables. We parameterize the impulse vector $ \mathbf{\alpha} $ of the unit sphere in $ n $-space by randomly drawing $ n-1 $ from a standard Normal distribution and mapping the draw onto the $ n $ unit sphere using a stereographic projection.

SRVAR EViews Add-in

Now we turn to the implementation of the SRVAR add-in. First, we need to download and install the add-in from the EViews website. The latter can be found at https://www.eviews.com/Addins/srvar.aipz. 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 srvar add-in and click on Install.


Figure 1: Polynomial Sieve Estimation

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


Figure 2: Uhlig (2005) Data

Next, we take the logarithm of the series gdpc1 (real gdp), gdpdef (gdp price deflator), cprindex (commodity price index), totresns (total reserves), and bognonbr (non-borrowed reserves). To do this, we can issue the following EViews commands:

series gdpc1 = @log(gdpc1)*100.0
series gdpdef = @log(gdpdef)*100.0
series cprindex = @log(cprindex)*100.0
series totresns = @log(totresns)*100.0
series bognonbr = @log(bognonbr)*100.0
We now replicate Figures 5, 6, and 14 from Uhlig (2005). In particular, using the aforementioned variables, Uhlig (2005) first estimate a VAR with 12 lags without a constant and trend. We can of course do this in EViews as follows:

  1. Click on Quick/Estimate VAR... to open the VAR estimation window.
  2. In the VAR estimation window, under Endogenous variables, enter gdpc1 gdpdef cprindex fedfunds bognonbr totresns.
  3. Under Lag Intervals for Endogenous enter 1 12
  4. Under the Exogenous variables, remove the c to remove the constant.
  5. Hit OK

Figure 3: VAR Estimation Window


Figure 4: VAR Estimation Results

Next, we obtain the 60 period-ahead impulse response function using asymptotic standard error bands and fedfunds as the impulse. We can do this as follows:

  1. From the VAR estimation window, click on View/Impulse Response... to open the impulse response estimation window.
  2. Under Display Format, click Multiple Graphs.
  3. Under Response Standard Errors, click on Analytic (asymptotic)
  4. Under Impulses, enter fedfunds.
  5. Under Responses enter gdpc1 gdpdef cprindex bognonbr totresns
  6. Under Periods, enter 60
  7. Hit OK

Figure 5: IRF Estimation Window

At last, Figure 5 of Uhlig (2005) is replicated below:

Figure 6: IRF Graphs

The price puzzle pointed out by Sims (1992) is clearly visible in the graphs above. In particular, the GDP deflator increases after a contractionary monetary policy shock. By contrast, the sign restricted identification approach (show in Figure 9 below), avoids the price puzzle by construction.

To demonstrate how sign restricted VARs avoid the price puzzle, we now make use of the SRVAR add-in. In this regard, we first create the sign restriction vector. In particular, Uhlig (2005) suggests that the impulse responses be positive on the 4th variable fedfunds, and negative on the 2nd variable gdpdef, the 3rd variable cprindex, and the 5th variable bognonbr. Thus, we create the sign restriction vector by issuing the following command:
vector rest = @fill(+4, -2, -3, -5)
At last, we invoke the SRVAR add-in and proceed with the rejection method as the SRVAR impulse response algorithm. We do this by clicking on the Add-ins menu in the main EViews menu, and click on Sign restricted VAR. This opens the SRVAR add-in window. There, we enter the following details:

  1. Under Endogenous variables enter gdpc1 gdpdef cprindex fedfunds bognonbr totresns.
  2. Click on Include constant, to remove the checkmark.
  3. Under Number of lags, enter 12.
  4. In the Sign restriction vector textbox enter +4, -2, -3, -5.
  5. In the Number of horizons enter 60
  6. For the Maximum number of restrictions enter 6
  7. Hit OK
The steps above produce a graph of sign restricted VAR impulse responses which correspond to Figure 6 in Uhlig (2005).

Figure 7: SRVAR Impulse Responses (Rejection Method)

From the SRVAR impulse response graph, it is readily seen that there is no price puzzle by construction. However, the impulse response of real GDP is within a ±0.2% interval around zero. Alternatively, if using the SRVAR penalty function algorithm, the analogous figure is presented below:

Figure 8: SRVAR Impulse Responses (Penalty Function Method)

Conclusion

In this blog entry we presented the sign restricted VAR add-in for EViews. The add-in is based on the work of Uhlig (2005) and generates impulse response curves based on Bayesian inference which accommodate sign restrictions in the VAR model. In the next blog, we will describe the implementation of the ARW add-in which will show how to impose zero restrictions on the impact period of the impulse response function.


References

  1. Uhlig Herald. What macroeconomist should know about unit roots: a Bayesian perspective. Economic Theory, 10:645–671, 1994.
  2. Uhlig Herald. What are the effects of monetary policy on output? Results from an agnostic identification procedure. Journal of Monetary Economics, 52(2):381–419, 1995.

7 comments:

  1. SRVAR add-in does not work (error 193 in encrypted program), only command line option is available.

    ReplyDelete
  2. In the sign restriction text box enter +4, -2, -3, -5. We will correct it soon.
    For command line, use the rest vector

    ReplyDelete
  3. How can we get the lower and upper bounds of the confidence interval of the BVAR?

    ReplyDelete
    Replies
    1. tick the checkbox (save IRF)

      Delete
    2. It says Eviews cannot calculate the IRFs error bounds for BVAR.
      Are you sure we can have the CI for IRFS after BVAR estimation?

      Delete
    3. I thought you asked about the SRVAR add-in. Are asking about the BVAR built-in program?

      Delete
    4. Yes, I am asking about the BVAR built-in porgram. Do you have any advise? Eviews says that the error bands are no available.

      Delete