Page 1 of 1

Running the same regression with different dependent and indepedent variables

Posted: Tue Aug 15, 2017 12:42 am
by Fatih
Hello, I am new to this forum. And I need help about a regression I would like to run. The regression I would like to run is a time series equation. It is the Fama-French type.To be more specific, I would like to run

Return(t) = c+ Volume(t) + Volatility(t)+Size(t) etc...

I have hundreds of companies in my dataset. For each company, I have to run the above stated regressions and then I have to get the list of the resulting coefficient estimates. Since, I have too many companies, it is impossible to do it by hand. I have been searching the forums for some possible programming ideas but couldn't come up with anything. Any help would be greatly appreciated.

Re: Running the same regression with different dependent and indepedent variables

Posted: Tue Aug 15, 2017 8:06 am
by EViews Gareth
Have you read through this?
viewtopic.php?f=5&t=1638

Re: Running the same regression with different dependent and indepedent variables

Posted: Tue Aug 15, 2017 11:09 am
by Fatih
Yes but I have been struggling through the codes. :(

Re: Running the same regression with different dependent and indepedent variables

Posted: Sun Aug 20, 2017 1:56 pm
by Fatih
For the topic mentioned above, I tried to write this code

series year = @year
!minyear = @min(year)
series monthnum = @month + 12*(year-!minyear)
!nummonths = @max(monthnum)
matrix(3,48) coefs
equation eq
for !k=1 to !nummonths
smpl if monthnum=!k
for !i=1 to 48
for !j=1 to 48
for !t=1 to 48
if !i=!j=!t then
equation eq.ls rm_rf c a{!j} b{!j} c{!t}
colplace(coefs, eq.@coefs, !i)
endif
next
next
Next
next

I have 2 problems though. I keep getting the insufficient number of observations error. I have blank cells. So, my first question is how to skip these blank cells? Second, I need to store the constant and 3 different independent variables for 66 months for 48 companies. So, I need to create a 4x66x48 cube. I'd appreciate your help.

Re: Running the same regression with different dependent and indepedent variables

Posted: Mon Aug 21, 2017 8:05 am
by EViews Gareth
Is there a reason for the triple loop? If you only want something to happen when i=j=t, then why not just have one loop?

Code: Select all

series year = @year
!minyear = @min(year)
series monthnum = @month + 12*(year-!minyear)
!nummonths = @max(monthnum)
matrix(3,48) coefs
equation eq
for !k=1 to !nummonths
smpl if monthnum=!k
for !i=1 to 48
equation eq.ls rm_rf c a{!i} b{!i} c{!i}
colplace(coefs, eq.@coefs, !i)
Next
next

Re: Running the same regression with different dependent and indepedent variables

Posted: Mon Aug 21, 2017 11:49 am
by Fatih
Basically, it was a copy paste, but I used the first loop for the months. I have a daily dataset that runs from 2007 to 2013. For each month, I want to run a regression for specific companies using their specific financial rations. The "k" is used to choose the month between 2007 and 2013. The second and third ones, i and j chooses the company and the financial ratios that belong to those companies in that specific month.