Help with user estimation of SVAR impulse responses

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

drizzy71
Posts: 4
Joined: Mon Feb 06, 2017 4:42 pm

Help with user estimation of SVAR impulse responses

Postby drizzy71 » Sun Apr 02, 2017 3:48 am

I have been posting quite a bit but I think i narrowed my question enough so that maybe someone might be able to help. Any input is greatly appreciated..

First of all, I want to make clear that the relationships in this SVAR are nonsensical. This workfile was just the one provided by the eviews SVAR book, and I was just making arbitrary restrictions to try out the a code that i eventually want to use to implement an SVAR with Block Exogeneity. Thus my questions right now are simply focusing on making sure that my code produces correct impulse response functions.

I have been running into a big problem with my code in that any time I try to build IRFs for SVARs 2 or more lags, the IRFs are not correct. I am attaching a modified workfile and two eviews programs. I will explain below exactly what the pages in the workfile refer to and where to use the eviews programs. Note that in these workfile and code files I will be trying to build SVAR with short run restrictions only, because I am trying to double check the accuracy of my programs by comparing my user built IRFs with those provided through more straighforward Eviews functions. If I can get these working, I will simply apply them to my model (which will have block exogeneity) with no issues, but at this moment in time the program is not fully working and that is why I am asking for your help.

In the workfile there are four pages. I will first address the first two pages called 1LagProgramIRF_Unsolved and 1LagProgramIRF_Solved. In the first page you will find two graph objects that show estimate the IRFs of an SVAR(1) with short-run restrictions (no block exogoeneity here) which can be found in the matrices (ahat or contemp_restrictions). These are the same exact IRFs (of an RUS shock on all the variables) of the same SVAR(1), I simply estimated it in two different ways, through the Structural Factorization option in the VAR object (with the matrices contemp_restrictions and contempB) and through the system object and by extracting the implied matrices (ahat and bhat). As you will see the graphs are identical as they should be. I then run the version of my program (built for 1 lag svars) to build the IRFs from scratch to check if my user built IRFs match these two. By running the code in buildingirf_programsvar1lag, on 1LagProgramIRF_Unsolved page, you get 1LagProgramIRF_Solved. i then graph the user built IRF I created, impRUS and graph it and save it as a graph object called rus_irf_through_program. As you will see, this graph is identical to other two graphs, indicating to me that my code for building IRFs of SVAR(1)s is correct!

My big issue is when i try to generalize this code to high order SVARs. The next two pages of the workfile and their corresponding program will illustrate this. The next two pages of the workfile are 2LagProgramIRF_Unsolved and 2LagProgramIRF_Solved. These follow the exact same structure (and notation and variable names) as the first two pages except for the fact that they estimate the SVAR with two lags. Accordingly, with the program buildingirf_programsvar2lag, I try to build IRFs for this SVAR(2) with my code instead of through the built in eviews functionality and see if the IRFs from the user built program match the Eviews provided IRFs. I graph the IRF obtained through my 2 lag code and it can be found in 2LagProgramIRF_Solved under the name rus_irf_through_program and as you can see this graph varies heavily with the Eviews provided IRFs for SVAR(2). Thus this indicates to me that my code for SVAR(2) is wrong. In my code for SVAR(2) (which again, can be found in buildingirf_programsvar2lag) I comment in the section where I am sure the error can be found (the last third of the code) and I indicate the sections that I think are the most problematic, but that to be quite honest, I don't know how to fix (I believe the problem is that I dont understand the linear algebra behind the calculations of responses, but I am not sure). Thus, it would be of an unimaginable help if you could take a look at the code for SVAR(2) and see if you understand why the IRFs it creates don't match the EViews provided ones. Everything else, I can take care of.

Apologies for the long read but i wanted to be as precise as possible so you could understand my problem and not spend too much time on it. Please let me know if I can explain anything in more detail or if anything of the such. I really have run out of other resources for this issue so any help or idea is immensely useful. Thanks all for reading this. Cheers.
Attachments
buildingirf_programsvar2lags.rtf
(5.09 KiB) Downloaded 298 times
buildingirf_programsvar1lag.rtf
(3.32 KiB) Downloaded 296 times
brazilsvarexample.wf1
(472.65 KiB) Downloaded 276 times

EViews Matt
EViews Developer
Posts: 560
Joined: Thu Apr 25, 2013 7:48 pm

Re: Help with user estimation of SVAR impulse responses

Postby EViews Matt » Mon Apr 03, 2017 10:46 am

Hello,

The only error I've found is a transposed matrix multiplication. In your SVAR(2) program, the line that calculates "cc1 = cc0*b1" should be "cc1 = b1*cc0".


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 19 guests