Reiterate VAR

For questions regarding programming in the EViews programming language.

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

buyukustun
Posts: 4
Joined: Mon May 22, 2017 11:42 am

Reiterate VAR

Postby buyukustun » Mon May 22, 2017 12:24 pm

Hello !

I'm new to Eviews and struggled today to learn some syntax, but I only managed to get tangled and frustrated.
I'm having about 200 series of data in a workfile. I'm trying to apply VAR in the following order: each 3 series (in alphabetical order) should be analyzed by VAR and Granger-causality two-by-two.
Thus, for example, if I have series: 1,2,3,4,5,6, I'll be interested in applying var to: (1,2),(1,3),(2,3); (4,6),(4,5),(5,6)... therefore, there should be independent batches of three series.
The type of VAR applied is with error regression, because I have previously verified the series for co-integration.

The output should be placed in any readable manner in a new table or textfile (whatever).
I can't do this manually, because there are a lot of series...

I hope someone can help.

Thanks a bunch !

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

Re: Reiterate VAR

Postby EViews Matt » Mon May 22, 2017 3:09 pm

Hello,

Sounds like it's time to write yourself an EViews program. We can get you started with a framework that will let you go through all your series in pairs as you've described:

Code: Select all

' Create a string list of all the series names.
%series = @wlookup("*", "series")
' Iterate through the series names three at a time.
for %a %b %c {%series}
   ' Create a list of pairs of the three series names.
   %pairs = %a + " " + %b + " " + %a + " " + %c + " " + %b + " " + %c
   ' Iterate through the pairs.
   for %first %second {%pairs}

      ' Analyze series %first and %second here.

   next
next

Inside the inner for loop you can perform whatever analysis you please.

buyukustun
Posts: 4
Joined: Mon May 22, 2017 11:42 am

Re: Reiterate VAR

Postby buyukustun » Tue May 23, 2017 6:06 am

Great Matt, thanks !

However, now I have a different dilemma :)
How can I save the results in a certain group/table etc. ? Moreover, if possible, can I program to extract only certain fields from the output ?

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

Re: Reiterate VAR

Postby EViews Gareth » Tue May 23, 2017 6:22 am

Follow us on Twitter @IHSEViews

buyukustun
Posts: 4
Joined: Mon May 22, 2017 11:42 am

Re: Reiterate VAR

Postby buyukustun » Fri May 26, 2017 11:11 am

Code: Select all

' Create a string list of all the series names.
%series = @wlookup("*", "series")
%name = "aann"
!i = 1
' Iterate through the series names three at a time.
for %a %b %c {%series}
   ' Create a list of pairs of the three series names.
   %pairs = %a + " " + %b + " " + %a + " " + %c + " " + %b + " " + %c
   ' Iterate through the pairs.
   for %first %second {%pairs}
   
      ' Analyze series %first and %second here.
   var {%name}{!i}.ec(c, 1) 1 1 %first %second
   freeze {%name}{!i}
   !i= !i+1
   
   next
next


When executing the code, I get the following error:
Alpha series in specification -...
But I have no alpha series. All my series are numerical and represented by a line-icon. What could the problem be ?

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

Re: Reiterate VAR

Postby EViews Gareth » Fri May 26, 2017 11:18 am

Change:

Code: Select all

var {%name}{!i}.ec(c, 1) 1 1 %first %second

to:

Code: Select all

var {%name}{!i}.ec(c, 1) 1 1 {%first} {%second}


You'll almost certainly want to use a name on the freeze command too:

Code: Select all

freeze(out_{%name}{!i}) {%name}{!i}
Follow us on Twitter @IHSEViews

buyukustun
Posts: 4
Joined: Mon May 22, 2017 11:42 am

Re: Reiterate VAR

Postby buyukustun » Sat May 27, 2017 11:34 am

So, now I try to save all results of each VAR into a single table by first freezing each result and then importing the necessary data (by raw and column) into a table I created.

This is the code:

' Create a string list of all the series names.
%series = @wlookup("*", "series")
%name = "aann"
table savevar
!i = 1
!j = 0
' Iterate through the series names three at a time.
for %a %b %c {%series}
' Create a list of pairs of the three series names.
%pairs = %a + " " + %b + " " + %a + " " + %c + " " + %b + " " + %c
' Iterate through the pairs.
for %first %second {%pairs}

' Analyze series %first and %second here.
var {%name}{!i}.ec(c, 1) 1 1 {%first} {%second}
freeze (out_{%name}{!i}) {%name}{!i}
savevar (i!+j!,1) = out_{%name}{!i} (1,1)
savevar (i!+1+j!,1) = out_{%name}{!i} (2,1)
savevar (i!+1+j!,1) = out_{%name}{!i} (3,1)
savevar (i!+2+j!,1) = out_{%name}{!i} (4,1)
savevar (i!+3+j!,1) = out_{%name}{!i} (5,1)
savevar (i!+4+j!,1) = out_{%name}{!i} (6,1)
savevar (i!+5+j!,1) = out_{%name}{!i} (7,1)
savevar (i!+6+j!,1) = out_{%name}{!i} (8,1)
savevar (i!+7+j!,1) = out_{%name}{!i} (9,1)
savevar (i!+8+j!,1) = out_{%name}{!i} (10,1)
savevar (i!+9+j!,1) = out_{%name}{!i} (11,1)
savevar (i!+10+j!,1) = out_{%name}{!i} (12,1)
savevar (i!+11+j!,1) = out_{%name}{!i} (13,1)
savevar (i!+12+j!,1) = out_{%name}{!i} (14,1)
savevar (i!+13+j!,1) = out_{%name}{!i} (15,1)
savevar (i!+14+j!,1) = out_{%name}{!i} (16,1)
savevar (i!+15+j!,1) = out_{%name}{!i} (17,1)
savevar (i!+16+j!,1) = out_{%name}{!i} (18,1)
savevar (i!+17+j!,1) = out_{%name}{!i} (19,1)
savevar (i!+18+j!,1) = out_{%name}{!i} (20,1)
savevar (i!+19+j!,1) = out_{%name}{!i} (21,1)
savevar (i!+20+j!,1) = out_{%name}{!i} (22,1)
savevar (i!+21+j!,1) = out_{%name}{!i} (23,1)
savevar (i!+22+j!,1) = out_{%name}{!i} (24,1)
savevar (i!+23+j!,1) = out_{%name}{!i} (25,1)
savevar (i!+24+j!,1) = out_{%name}{!i} (26,1)
savevar (i!+25+j!,1) = out_{%name}{!i} (27,1)
savevar (i!+26+j!,1) = out_{%name}{!i} (28,1)
savevar (i!+27+j!,1) = out_{%name}{!i} (29,1)
savevar (i!+28+j!,1) = out_{%name}{!i} (30,1)
savevar (i!+29+j!,1) = out_{%name}{!i} (31,1)
savevar (i!+30+j!,1) = out_{%name}{!i} (32,1)
savevar (i!+31+j!,1) = out_{%name}{!i} (33,1)
savevar (i!+32+j!,1) = out_{%name}{!i} (34,1)
savevar (i!+33+j!,1) = out_{%name}{!i} (35,1)
savevar (i!+34+j!,1) = out_{%name}{!i} (36,1)
savevar (i!+35+j!,1) = out_{%name}{!i} (37,1)

!i= !i+1
!j = !j + 37

next
next


However, I receive the following error:
OUT_AANN1 is not defined in "FREEZE (OUT_AANN1) AANN1".
Syntax error in "SAVEVAR (I!+J!,1) = OUT_AANN1 (1,1)".
....

What's the problem ? The freeze(d) object is not a table ?

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

Re: Reiterate VAR

Postby EViews Gareth » Sat May 27, 2017 4:31 pm

You have a space before the "(".

For what it is worth, you might want to look at using VAR data member to retrieve information.
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 24 guests