Pairwise regression code

For questions regarding programming in the EViews programming language.

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

lbkova
Posts: 12
Joined: Wed Mar 04, 2009 7:16 am

Pairwise regression code

Postby lbkova » Wed Apr 15, 2009 2:32 am

Hello All,

I would need a code to do pairwise regressions to test for cointegration relations among 8 variables with the Engle-Granger method (e.g. first running simple LS regressions then testing for the stationarity of the error terms). I know that it would mean running (n*(n-1))/2 (8*7/2=28) regressions. Could you please help me how I can run these regressions?

Many thans,

Laszlo

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

Re: Pairwise regression code

Postby EViews Gareth » Wed Apr 15, 2009 8:08 am

This should get you started:

Code: Select all

'make some data
create u 100

for !i=1 to 8
series x!i=nrnd
next


'perform regressions
group xs x*

equation eq

for !i=1 to xs.@count-1
   for !j=!i+1 to xs.@count
      %iname = xs.@seriesname(!i)
      %jname = xs.@seriesname(!j)
      eq.ls {%iname} c {%jname}
      eq.makeresids res_{%iname}_{%jname}
   next
next
Follow us on Twitter @IHSEViews

lbkova
Posts: 12
Joined: Wed Mar 04, 2009 7:16 am

Re: Pairwise regression code

Postby lbkova » Wed Apr 15, 2009 8:26 am

Hello Gareth,

This seems to be working... Great help! Many thanks! :D

Laszlo


Return to “Programming”

Who is online

Users browsing this forum: Google [Bot] and 11 guests