choosing variable randomly via a table vs group

For questions regarding programming in the EViews programming language.

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

pinson
Posts: 4
Joined: Wed Jul 25, 2018 2:37 am

choosing variable randomly via a table vs group

Postby pinson » Mon Oct 29, 2018 5:46 am

hello,
I have the following program, which firs runs regressions and creates series of residuals. I need to regress the residuals series on each other (bivariate) whereby I chose the dependent variable randomly. I did it by creating a group, but am told that it is too complicated and could be done by putting the names of the series into a table and picking them up from that table. I dont know how to do that, however, so would appreciate your views.

smpl 1 100
for %y ser1 ser2 ser3 ser4 ser5 ser6 ser7 ser8 ser9 ser10
series {%y}=@rnd
next

for %x ser2 ser3 ser4 ser5 ser6 ser7 ser8 ser9 ser10
equation ser1{%x}.ls ser1 {%x} c
ser1{%x}.makeresid ser1{%x}leftover
next

group gres *over

for !i=1 to gres.@count
residuals (!i,1)=gres.@seriesname(!i)
next

!x=@round(@runif(1,10))

for !i= 1 to gres.@count
%iname=gres.@seriesname(!i)
%xname=gres.@seriesname({!x})
if !i<>{!x} then
equation _eq{!i}.ls {%xname} {%iname} c
endif
next

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

Re: choosing variable randomly via a table vs group

Postby EViews Matt » Mon Oct 29, 2018 10:07 am

Hello,

I confess that I don't see how your program could be simplified by using a table to store series names instead of using a group. If there was going to be a table containing the series names anyway (third for loop?), perhaps holding results, then the group would be redundant. Otherwise, if this is truly a one-or-the-other choice, then I believe the group implementation is actually simpler (primarily because you can create it and fill it with the series names in a single statement).

pinson
Posts: 4
Joined: Wed Jul 25, 2018 2:37 am

Re: choosing variable randomly via a table vs group

Postby pinson » Mon Oct 29, 2018 12:39 pm

Thank you, Matt, for your view.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 18 guests