estimating y and x pairs

For questions regarding programming in the EViews programming language.

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

Laurel
Posts: 19
Joined: Mon May 04, 2020 2:39 pm

estimating y and x pairs

Postby Laurel » Tue Oct 13, 2020 11:59 pm

Code: Select all

'create a workfile wfcreate q 1990 2010 'create 5 y and 5 x series for %y y1 y2 y3 y4 y5 series {%y}=nrnd for %x x1 x2 x3 x4 x5 series {%x}=nrnd 'run pairwise regressions between each series equation eq_{%y}_{%x}.ls {%y} c {%x} next next
Hello! How do I modify the above code so that only the five equation objects with matching y's and x's are created: eq_y1_x1, eq_y2_x2,eq_y3_x3,eq_y4_x4,eq_y5_x5? Thanks!

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

Re: estimating y and x pairs

Postby EViews Gareth » Wed Oct 14, 2020 8:17 am

Code: Select all

'create a workfile wfcreate q 1990 2010 'create 5 y and 5 x series for %y y1 y2 y3 y4 y5 series {%y}=nrnd next for %x x1 x2 x3 x4 x5 series {%x}=nrnd next 'run pairwise regressions between each series for !i = 1 to 5 equation eq_{!i}.ls y{!i} c x{!i} next

Laurel
Posts: 19
Joined: Mon May 04, 2020 2:39 pm

Re: estimating y and x pairs

Postby Laurel » Wed Oct 14, 2020 8:39 am

Thank you. But what if the series names are xa, xb, xc, xd, xe and ya, yb, yc, yd, ye?

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

Re: estimating y and x pairs

Postby EViews Matt » Wed Oct 14, 2020 1:15 pm

Hello,

You could loop over the common suffix of the x? and y? series, e.g.

Code: Select all

for %s a b c d e equation eq_y{%s}_x{%s}.ls y{%s} c x{%s} next
Similarly named objects let you write terse loops, but can always explicitly list all the names and loop over groups of those elements, e.g.

Code: Select all

for %y %x ya xa yb xb yc xc yd xd ye xe equation eq_{%y}_{%x}.ls {%y} c {%x} next


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests