Page 1 of 1

Storing coefficients of regressions on several series'

Posted: Tue Feb 10, 2015 7:46 am
by ekyle
Hi, I've thoroughly read through many of the Eviews guides as well as posts on this forum, which have been very helpful. Nonetheless I am fairly stuck on what direction to take. What I am looking to do is have several series of data (stock information), be regressed using the same x values/series (usd, spx, etc...), and be able to produce something in a table format that will have each dependant variable (stock names, per say) listed in the first column, followed by their coefficients from the regressions in the columns to the right. I hope this is clear. I am not asking for anybody to write out a program or anything like that, but perhaps someone could point me in the right direction of where to go, as at this point I have only a basic program written out and am fairly unsure how to create such a table.

Thanks,

Kyle

Re: Storing coefficients of regressions on several series'

Posted: Tue Feb 10, 2015 7:53 am
by EViews Gareth
What have you done so far?

Re: Storing coefficients of regressions on several series'

Posted: Tue Feb 10, 2015 8:00 am
by ekyle
Appreciate the quick reply. At this point all I've been able to do is write a simple program that runs the regression for whichever series I include. Not sure how to proceed - certianly have tried figuring it out and attempt different things but I'm pretty off point.

'Create a group which will contain all series'
group main_grp

'Adds each series to main_grp
for %i s5cond s5cons s5enrs s5finl
main_grp.add {%i}

for !i=1 to main_grp.@count

%iname = main_grp.@seriesname(!i)

'Run regression on each series in main_grp
equation eq_{%iname}.ls {%iname} c dxy spx

next
next

Re: Storing coefficients of regressions on several series'

Posted: Tue Feb 10, 2015 9:12 am
by EViews Gareth
Before the loop, create a table object:

Code: Select all

table mytable
Then after you've estimated each equation in the loop, add that equation's coefficients to the table:

Code: Select all

mytable(!i,1) = eq_{%iname}.@coef(1) mytable(!i,2) = eq_{%iname}.@coef(2)

Re: Storing coefficients of regressions on several series'

Posted: Tue Feb 10, 2015 12:45 pm
by ekyle
Thanks a bunch...I've now been able to get to a better point where I am generating a table with my data lined up how I would like. As you can see from my program below, I've used %0, %1 etc method to be able to have my coefficients as column headers by typing in the coefficient in the "program arguments" field when I run the program...however, this is fairly inconvenient and I feel like there is an easier way to do this. How can I format my table to have my dependant variables (aligned properly with the coefficient they represent) as column headers?

Thanks very much for your help.

Code: Select all

'Create a group which will contain all series' group main_grp 'create table table coefficient_table 'Add each series to main_grp that begins with "pe" %list = @wlookup("pe*", "series") for %i {%list} main_grp.add {%i} for !i=1 to main_grp.@count 'return name of the ith series in the main_grp %iname = main_grp.@seriesname(!i) 'Run regression on each series in main_grp equation eq_{%iname}.ls {%iname} c spx dxy cl1 'Create table to store coefficients coefficient_table(1,1)=%0 coefficient_table(1,2)=%1 coefficient_table(1,3)=%2 coefficient_table(1,4)=%3 coefficient_table(1,5)=%4 coefficient_table(1+!i,1)= %iname coefficient_table(1+!i,2) = eq_{%iname}.@coef(1) coefficient_table(1+!i,3) = eq_{%iname}.@coef(2) coefficient_table(1+!i,4) = eq_{%iname}.@coef(3) coefficient_table(1+!i,5) = eq_{%iname}.@coef(4) next next

Re: Storing coefficients of regressions on several series'

Posted: Tue Feb 10, 2015 2:44 pm
by EViews Gareth

Code: Select all

equation eq_{%iname}.ls {%iname} c spx dxy cl1 'Create table to store coefficients coefficient_table(1,1)="Stuff" coefficient_table(1,2)="C" coefficient_table(1,3)="SPX" coefficient_table(1,4)="DXY" coefficient_table(1,5)="CL1"