Detecting equation format & sorting correlations

For questions regarding programming in the EViews programming language.

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

tchaithonov
Posts: 168
Joined: Mon Apr 13, 2009 7:39 am
Location: New York City

Detecting equation format & sorting correlations

Postby tchaithonov » Sun Jun 07, 2009 4:38 pm

Hi everyone,

I have 2 questions when writing a small program in eviews. Firstly, is it possible for eviews to identify the format ( d( ), dlog(), log(), etc) of the dependent variable in a group after it creates the group by eq_xyz.makeregs group1? e.g.,

1st procedure:

Code: Select all

equation eq_xyz.ls(n) <some transformation of y> c {x variables}
2nd procedure:

Code: Select all

eq_xyz.makeregs group1 scalar varnum = eq_xyz.@count table tab for !i = 1 to varnum ' everything tab(!i,1) = eq_xyz.@seriesname(!i) next !i
(it's all algorithm beyond this point)
- 1st var in tab --> dep var
- check dep var's transformation
- if it's format a, do 1; format b, do 2, ...

Second question relates to sorting. I know there has been some discussions about sorting for a while, but I don't see if there is a way to sort results from correlation. Say, this is what I got so far:

Code: Select all

group gp_1 a b c d e freeze(table) gp_1.cor
if I am interested only in the correlation between variable a and the others (a & b, a & c, etc), and want to sort from highest to lowest their correlations, what should I do?

Thanks guys!

trubador
Did you use forum search?
Posts: 1520
Joined: Thu Nov 20, 2008 12:04 pm

Re: Detecting equation format & sorting correlations

Postby trubador » Sun Jun 07, 2009 11:46 pm

Regarding to your first question:

Code: Select all

if group1.seriesname(1) = "D(Y)" then ... else if group1.seriesname(1) = "DLOG(Y)" then ... else if group1.seriesname(1) = "LOG(Y)" then ... ... endif endif endif 'Please note that strings are case sensitive so you should write them in capitals
Regarding to your second question:

Code: Select all

vector(3) correl !k=1 for %i a for %j b c d correl(!k)=@cor({%i},{%j}) !k=!k+1 next next vector correl_sort=@sort(correl,"d") 'You should decide how to handle negative and positive correlations

tchaithonov
Posts: 168
Joined: Mon Apr 13, 2009 7:39 am
Location: New York City

Re: Detecting equation format & sorting correlations

Postby tchaithonov » Mon Jun 08, 2009 7:41 am

Thanks a lot, trubador! You've saved me a lot of time!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests