## Running the same regression with different dependent and indepedent variables

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator

Fatih
Posts: 5
Joined: Mon Aug 14, 2017 2:09 pm

### Running the same regression with different dependent and indepedent variables

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.

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

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

viewtopic.php?f=5&t=1638

Fatih
Posts: 5
Joined: Mon Aug 14, 2017 2:09 pm

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

Yes but I have been struggling through the codes.

Fatih
Posts: 5
Joined: Mon Aug 14, 2017 2:09 pm

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

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.

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

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

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) coefsequation eqfor !k=1 to !nummonths smpl if monthnum=!k for !i=1 to 48equation eq.ls rm_rf c a{!i} b{!i} c{!i}colplace(coefs, eq.@coefs, !i)Nextnext`

Fatih
Posts: 5
Joined: Mon Aug 14, 2017 2:09 pm

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

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.