How to Run automatically regression to n-Dependent variables

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

pandriko
Posts: 3
Joined: Fri Feb 19, 2010 6:28 am

How to Run automatically regression to n-Dependent variables

Postby pandriko » Fri Feb 19, 2010 7:00 am

Dear all :? ,

I am a new member to this forum and not knowledgable at all about programming. I am just now starting to learn some basic commands. I have the following enquiry. I need to run a cross-sectional regression for a 4-factor model to daily data of 4380 dependent variables and for approximately 238 months and summarise betas montlhy. Overal, this will require something such as 1,000,000+ regressions. So, I am trying to do it with a script by reading and trying to understand the examples of this forum. I have created something but it is unfortunately not working. The programe is as follows:
____________________________________________________________________________
Matrix (4380,4380) results
scalar ncoeff
scalar KK = 0
For !Y = 1 to 4380
equation eq1.ls com{!Y} c rpr{!Y} smb{!Y} hml{!Y} wml{!Y}
ncoeff = arc1.@ncoefs
For !K = 1 to Ncoeff
results(KK+1,!K) = arc1.@coefs(!K)
results(KK+2,!K) = arc1.@tstats(!K)
Next
results(KK+1,11) = arc1.@aic
results(KK+1,12) = arc1.@rbar2
results(KK+1,13) = arc1.@Logl
results(KK+1,14) = arc1.@ssr
Next
KK = KK + 3
Next
Show results
__________________________________________________________________________________

Unfortunately, the above script is not working and I can't see why (as I mentioned earlier I am not any good at all with programming. Any help will be greatly appreciated. I am using eviews 6. So, all my 254+ columns spreadsheets are first saved as txt first (tab delimited) and then imported into eviews6.

PS.
I have also attached a sample of the spreadsheet in picture that I use as a pilot data source if any if you want to have a look on the data (this is only two calendar month, 121 and 122 calendar months). Also, can someone suggest a book for starting with programming....(something for people with NO PRIOR EXPERIENCE whatsoever in programming).

Many thanks for any feedback and comments
Attachments
Spreadsheet Structure.jpg
Spreadsheet Structure.jpg (536.2 KiB) Viewed 6818 times

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

Re: How to Run automatically regression to n-Dependent variables

Postby EViews Gareth » Fri Feb 19, 2010 8:25 am

That's actually a pretty competently written program. The one obvious thing wrong is that you've named your equation EQ1, yet when you a referencing the members of that equation, you are asking for ARC1. I would guess that if you named your equation ARC1 rather than EQ1, it should work.

If it still doesn't work, you might want to give more information on how it isn't working (i.e. what error message is occurring, or what is going wrong).

pandriko
Posts: 3
Joined: Fri Feb 19, 2010 6:28 am

Re: How to Run automatically regression to n-Dependent variables

Postby pandriko » Fri Feb 19, 2010 9:17 am

Dear Gareth,

thank you for your prompt reply. The message I recieve is "COM1 is not defined in Equation ACR1.LS COM C PRP1 SMB1 HML1 WML1". It seems to me that what I wrote is incorrect as I mostly want it to run each dependent com1, com2....ect against independent (the same series all the time) rpr, hml, smb,wml. Once it do this for each of the com1,2,3..n dependent to go and store them in a matrix (1row x 4380columns) (one column per dependent), and for the general results to report all of the summary stats in the scalar ncoeff (I might be completely wrong here in the way I am writitng it). See the attached script *eviews6 window). I can't really see what exactly it means as COm1 is not defined as I "assume" that I defined com1,2,3...,n to the "For !Y = 1 to 4380"

Thanks
Attachments
eviews6.jpg
eviews6.jpg (337.35 KiB) Viewed 6797 times

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

Re: How to Run automatically regression to n-Dependent variables

Postby EViews Gareth » Fri Feb 19, 2010 10:24 am

That error message is indicating that it can't find a series called COM1. Are you sure there is such a series?

Also, looking at your screenshot, it appears that a lot of the visible COM series are in fact alpha series, not numerical series (you can tell by the little ABC symbol). You won't be able to run a regression with those variables.

pandriko
Posts: 3
Joined: Fri Feb 19, 2010 6:28 am

Re: How to Run automatically regression to n-Dependent variables

Postby pandriko » Fri Feb 19, 2010 11:09 am

Dear Gareth,

yes, I know that. I assume that the eviews will skip these alpha series once the script starts running. Also about the com1, once the table was imported in eviews this column was changed to COM101? Even if I exemppt this series and start from
For !Y = 3 to 4380, the mesage that comes immediately is "RPR3 is not defined in Equation ACR1.LS COM3 C PRP3 SMB3 HML3 WML3". But how can I have rpr3 when I only have 1 series for rpr?....Also if I delete the {!Y} symbols from the independent variables as I have only 1 series for them and make the "equation arc1.ls com{!Y} c rpr{!Y} smb{!Y} hml{!Y} wml{!Y} " into "equation arc1.ls com{!Y} c rpr smb hml wml", then message then is: "Aplha series in specification - COM3 @EXPAND can convert to categorical dummies in "equation arc1.ls com3 c rpr smb hml wml".

Thanks

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

Re: How to Run automatically regression to n-Dependent variables

Postby EViews Gareth » Fri Feb 19, 2010 2:04 pm

Ah, I hadn't understood you wanted different dependent variables, but the same regressors. In that case, yes, you will need to remove the {!y} from the dependent variable names.

EViews will always error on the cases where you have the alpha series. You can tell EViews to skip errors by setting the error count to a high value when you run the program.

pojarlie
Posts: 1
Joined: Wed Mar 03, 2010 12:53 pm

Re: How to Run automatically regression to n-Dependent variables

Postby pojarlie » Wed Mar 03, 2010 2:06 pm

Hi. I have a similar problem. I am trying to run 1000 regressions, using 1000 different dependant variables and the same 4 undependant variables. I also want to store the alphas and the t-statistics of the alpha.
Wrote the following, but it is not working. Any help would be appreciated.


'declare series for final results
matrix(2,1000) results1
scalar i = 1

'declare equation for estimation
'equation eq1
' point estimates

for !i = 1 to 1000

'estimate equation
eq1.ls gr1(!i) c carry afx ppp vol

results(1,!i) = eq1.@coefs(1)
results(2,!i)=eq1.@tstats(1)


next

show results1


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 1 guest