*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

- Introduction
- Bayesian Inference of SRVARs
- Recovering Structural Shocks from an SRVAR
- RSVAR EViews Add-in
- Conclusion
- 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:

- Run an unrestricted VAR in order to get $ \widehat{\mathbf{B}} $ and $ \widehat{\mathbf{\Sigma}} $.
- Randomly draw $ \bar{\mathbf{B}}_{T} $ and $ \mathbf{S}_{T} $ from the posterior distributions.
- Extract the orthogonal innovations from the model using a Cholesky decomposition.
- Calculate the resulting impulse responses from Step 3.
- Randomly draw an orthogonal impulse vector $ \mathbf{\alpha} $.
- Multiply the responses from Step 4 by $ \mathbf{\alpha} $ and check if they match the imposed signs.
- If yes, keep the response. If not, drop the draw.

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:

- Run an unrestricted VAR in order to get $ \widehat{\mathbf{B}} $ and $ \widehat{\mathbf{\Sigma}} $.
- Randomly draw $ \bar{\mathbf{B}}_{T} $ and $ \mathbf{S}_{T} $ from the posterior distributions.
- Extract the orthogonal innovations from the model using a Cholesky decomposition.
- Calculate the resulting impulse responses from Step 3.
- Minimize the penalty function with respect to an orthogonal impulse vector $ \mathbf{\alpha} $.
- Multiply the responses from Step 4 by $ \mathbf{\alpha}.$

### 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

*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

**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.0We 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:

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

Figure 3: VAR Estimation Window

Figure 4: VAR Estimation Results

**fedfunds**as the impulse. We can do this as follows:

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

Figure 5: IRF Estimation Window

Figure 6: IRF Graphs

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:

- Under
**Endogenous variables**enter*gdpc1 gdpdef cprindex fedfunds bognonbr totresns*. - Click on
**Include constant**, to remove the checkmark. - Under
**Number of lags**, enter*12*. - In the
**Sign restriction vector**textbox enter*+4, -2, -3, -5*. - In the
**Number of horizons**enter*60* - For the
**Maximum number of restrictions**enter*6* - Hit OK

Figure 7: SRVAR Impulse Responses (Rejection Method)

Figure 8: SRVAR Impulse Responses (Penalty Function Method)

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

ReplyDeleteIn the sign restriction text box enter +4, -2, -3, -5. We will correct it soon.

ReplyDeleteFor command line, use the rest vector

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

ReplyDeletetick the checkbox (save IRF)

DeleteIt says Eviews cannot calculate the IRFs error bounds for BVAR.

DeleteAre you sure we can have the CI for IRFS after BVAR estimation?

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

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

DeleteHi. While executing the add-in I always get the error "Error 15 in Encrypted Program". Any ideas or thoughts on this. Thanks

ReplyDeleteHello. I too get "Error 15 in Encrypted Program" while replicating the example above with the Uhlig data. Any suggestions? Thank you.

ReplyDeleteHello I also get Error 15 in Encrypted Program. Can anyone let me know what this error is about?

DeleteHi, I get error 127 in encrypted program, do you have any idea why?

ReplyDeleteI have the same ...

DeleteHi! How can I include multiple zero restrictions in the command line? Thanks a lot!

ReplyDeleteHi and thanks for the nice add-in. One question: Cant see how I choose different shocks to look at (the original only looks at monetary policy shocks via the fed fund rate); and a suggestion: would be a nice additional feature if one could choose cumulative IRFs. Thanks!

ReplyDeleteCan I generate the forecast from the sign restricted VARs?

ReplyDeletehello,

ReplyDeleteI am working on "state-dependent fiscal multiplier for 20 countries [annual data-panel data analysis] and [one shock only]

should I have to apply same procedure to estimate the impulse response for panel data as in time series data? if it is different, can you help me in sharing the link.

Best

hi everyone,

ReplyDeleteI need identify the demand and supply functions of loans by using 3 verables. so basically, the sign restrictions will be as below;

loan supply loan supply (core liabilities) Loan Demand

interest rates - - +

loans + + +

loans / core liabilities - + +

how can I achive this spesification via eviews?

How can set different shocks at the same time via ung sign restrictions

ReplyDeleteYes, the documentation is silent on this point. I would like to place restrictions on more than one shock but I get errors if I try to do that. For instance, in a 2x2 VAR I have my restriction vector as (+1, +2, +3, -4) to mean that the shock in equation 1 should have a positive effect on the first and second var and the shock in eqt2 should have a positive effect on var1 and negative on var2. But I get an error. What is the correct syntax? Thanks.

Delete