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

Postby Fatih » Tue Aug 15, 2017 12:42 am

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: 11283
Joined: Tue Sep 16, 2008 5:38 pm

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

Postby EViews Gareth » Tue Aug 15, 2017 8:06 am

Have you read through this?
viewtopic.php?f=5&t=1638
Follow us on Twitter @IHSEViews

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

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

Postby Fatih » Tue Aug 15, 2017 11:09 am

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

Postby Fatih » Sun Aug 20, 2017 1:56 pm

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: 11283
Joined: Tue Sep 16, 2008 5:38 pm

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

Postby EViews Gareth » Mon Aug 21, 2017 8:05 am

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
Follow us on Twitter @IHSEViews

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

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

Postby Fatih » Mon Aug 21, 2017 11:49 am

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.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 7 guests