SVAR batch automation, and impulse response tabulation

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

ckaas
Posts: 4
Joined: Thu May 13, 2010 12:36 am

SVAR batch automation, and impulse response tabulation

Postby ckaas » Thu May 13, 2010 1:26 am

I am working with a cumbersome amount of data, and am trying to put together as many batch programs as possible to automate the generation of impulse responses (and, later on, variance decompositions). I have run into a bit of a snag, however, and hope that someone might be able to offer some insight into the problem.

I have multiple time series in a workbook, and would like to write a program that would:
(1) Run VARs on each of the series, and impose short-run restrictions
(2) Generate impulse responses for each VAR
(3) Save the results of the impulse responses into a single matrix/table

For (1), I have written the following, which generates a VAR object for each of the series:
group var_group *
for !i=1 to var_group.@count
%name = var_group.@seriesname(!i)
var {%name}_VAR.ls 1 2 {%name} series01 series02 series03 series04 @
next

Question 1: What is the best way to incorporate the following type of short-run restrictions in the code?
@e1 = C(1)*@u1
@e2 = C(2)*@e1 + C(3)*@u2
@e3 = C(4)*@e1 + C(5)*@e2 + C(6)*@u3
@e4 = C(5)*@e1 + C(6)*@e2 + C(7)*@e3+ C(8)*@u4

For (2) I have begun playing with creating a loop around the following code:
seriesXX.impulse(10, matbyr=seriesXX_impulse) seriesXX @ series02

This creates a table object for each series, containing the impulse response of a seriesXX to an innovation in series02. Great, that's what I want. However:

Question 2: When I open the table object, I get many more columns than I thought I would. One of these corresponds to the impulse response I get when calling up the impulse response graphically by doing point-and-click. What do the other columns correspond to?

Question 3: I am wondering where I should go from here if I want to take the period-by-period impulse response of each SVAR I specified earlier, and put all these numbers into a single table? I haven't been able to figure this out yet, and may yet just resign myself to doing it manually.

Sorry for the rather long question. I'm new to batch programming in E-views, so I apologize if this turns out to be much simpler than I thought.

Thanks very much!

Christian

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13603
Joined: Tue Sep 16, 2008 5:38 pm

Re: SVAR batch automation, and impulse response tabulation

Postby EViews Gareth » Thu May 13, 2010 8:14 am

1)

Code: Select all

{%name}_VAR.append(svar) @e1 = C(1)*@u1 {%name}_VAR.append(svar) @e2 = C(2)*@e1 + C(3)*@u2
etc...


2)
Use smat= instead of matbyr=

3)I think you're getting confused between tables and matrices. Step 2 actually created a matrix, not a table. You can use the matplace function to put matrices into bigger matrices.

ckaas
Posts: 4
Joined: Thu May 13, 2010 12:36 am

Re: SVAR batch automation, and impulse response tabulation

Postby ckaas » Thu May 13, 2010 9:50 pm

Wonderful! Thanks a lot. I've managed to create individual matrices with the results of the impulse responses, and combine all these into one big matrix. I'm trying to do the same with the results of the variance decomposition, now. For decomp, however, smat seems to create multiple columns again. I've tried to add the "@ mb" operator to restrict the output only to the variance explained by the series mb, but I'm still getting more columns in the output that I bargained for. Is there a solution to be found here as well?

I've copied my code below. It's the same I used for impulse, just replacing impulse with decomp:

group SVAR_group *
SVAR_group.[some stuff here]

for !i=1 to SVAR_group.@count
%name = SVAR_group.@seriesname(!i)
{%name}_var.decomp(20, t, smat={%name}x) {%name} @ mb
close {%name}x
close {%name}_var
next

matrix(21,48) decomp_results

for !i=1 to SVAR_group.@count
%name = SVAR_group.@seriesname(!i)
decomp_results(1,!i)={%name}
delete {%name}x
next

Thanks again for the kind help.
Christian


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest