Page 1 of 1

Pairwise regression code

Posted: Wed Apr 15, 2009 2:32 am
by lbkova
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

Re: Pairwise regression code

Posted: Wed Apr 15, 2009 8:08 am
by EViews Gareth
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

Re: Pairwise regression code

Posted: Wed Apr 15, 2009 8:26 am
by lbkova
Hello Gareth,

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

Laszlo