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 FamaFrench 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.
Running the same regression with different dependent and indepedent variables
Moderators: EViews Gareth, EViews Jason, EViews Moderator

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11774
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Running the same regression with different dependent and indepedent variables
Have you read through this?
viewtopic.php?f=5&t=1638
viewtopic.php?f=5&t=1638
Follow us on Twitter @IHSEViews
Re: Running the same regression with different dependent and indepedent variables
Yes but I have been struggling through the codes.
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.
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.

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11774
 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) 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
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.
Who is online
Users browsing this forum: No registered users and 3 guests