Dummy Variables
Moderators: EViews Gareth, EViews Moderator

 Posts: 5
 Joined: Tue Nov 11, 2014 10:32 pm
Re: Dummy Variables
Thanks very much Startz  worked a treat!
Re: Dummy Variables
Hi,
I have data set f companies capital structure in following way:
Year Company Industry Capital structure factors
2010 A IT ....
2011 A IT .....
2012 A IT 
2010 D Service 
2011 D Service
2012 D Service
2010 B Manufacture
2011 B Manufacture
2012 B Manufacture
I want to create industry dummies for each of the industry groups.
Purpose is to use industry as a control variable when anaysing capital structure influence on companies performance.
So after I have created these groups I would like to create an industry dummy variable and see/control how industry affect on results. How do I do this?
Thanks in advance.....
I have data set f companies capital structure in following way:
Year Company Industry Capital structure factors
2010 A IT ....
2011 A IT .....
2012 A IT 
2010 D Service 
2011 D Service
2012 D Service
2010 B Manufacture
2011 B Manufacture
2012 B Manufacture
I want to create industry dummies for each of the industry groups.
Purpose is to use industry as a control variable when anaysing capital structure influence on companies performance.
So after I have created these groups I would like to create an industry dummy variable and see/control how industry affect on results. How do I do this?
Thanks in advance.....

 Nonnormality and collinearity are NOT problems!
 Posts: 3175
 Joined: Wed Sep 17, 2008 2:25 pm
Re: Dummy Variables
@expand(industry)

 Posts: 6
 Joined: Mon Nov 06, 2017 12:12 pm
Re: Dummy Variables
Basic version: Basically I would like to have something like to create 1440 time dummies, one for each hour over 5 years. Using expand does not work since it only allows two timeframes, so I would like to use expand(@hour,@month,@year) but it doesn't work. What would be the alternative?
I've looked at many resources but can't seem to find an answer to this. Basically I have various time series related to weather and would like to perform an OLS estimation. As a simple example:
y=constant+b1*rain+b2*sunshine
The data are hourly and spans 5 years. The amount of rain and sunshine that occur at a given hour are related to the amount of the same variable in the preceding hour so I address this either with an autoregressive process or by first differencing the equation above and dropping the constant.
However with weather there are also hourly patterns at play (for example, more sunshine at given times of the day), monthly patterns and yearly patterns (some months and years have uncharacteristic amounts of sunshine or rain). For this reason I would like to use time fixed effects, which would essentially be dummy variables for each hourmonthyear of the sample. Assuming the sample had 5 years this would mean having 5years * 12 months * 24 hours for a total of 1440 fixed effects dummies.
The question is if there is any way to create these dummies automatically in the regression command? Or to create the dummies prior to running the regression, and how would I do these steps of creating them and then include the 1440 dummies in the command?
TLDR: how do I create 1440 time fixed effects dummies (one for each hour over 5 years), and then use it in the regression command?
I've looked at many resources but can't seem to find an answer to this. Basically I have various time series related to weather and would like to perform an OLS estimation. As a simple example:
y=constant+b1*rain+b2*sunshine
The data are hourly and spans 5 years. The amount of rain and sunshine that occur at a given hour are related to the amount of the same variable in the preceding hour so I address this either with an autoregressive process or by first differencing the equation above and dropping the constant.
However with weather there are also hourly patterns at play (for example, more sunshine at given times of the day), monthly patterns and yearly patterns (some months and years have uncharacteristic amounts of sunshine or rain). For this reason I would like to use time fixed effects, which would essentially be dummy variables for each hourmonthyear of the sample. Assuming the sample had 5 years this would mean having 5years * 12 months * 24 hours for a total of 1440 fixed effects dummies.
The question is if there is any way to create these dummies automatically in the regression command? Or to create the dummies prior to running the regression, and how would I do these steps of creating them and then include the 1440 dummies in the command?
TLDR: how do I create 1440 time fixed effects dummies (one for each hour over 5 years), and then use it in the regression command?

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11378
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Dummy Variables
You could do something like:
Code: Select all
alpha hourmonthyear = @str(@hour) + "" + @str(@month) + "" + @str(@year)
show @expand(hourmonthyear)
Follow us on Twitter @IHSEViews

 Posts: 6
 Joined: Mon Nov 06, 2017 12:12 pm
Re: Dummy Variables
Thanks, tried it and seems to construct the dummies well but when performing a standard OLS in levels using @expand(hourmonthyear,@dropfirst) I get an error message:
Matrix size error : too many parameters for default coefficient vector.
I have nearly 30000 observations (using 2.5 years of the data) and use no other constant or dummy in the regression
Matrix size error : too many parameters for default coefficient vector.
I have nearly 30000 observations (using 2.5 years of the data) and use no other constant or dummy in the regression

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11378
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Dummy Variables
On the options tab of the Estimation dialog enter "beta" in the "Coefficient name" box.
Follow us on Twitter @IHSEViews

 Nonnormality and collinearity are NOT problems!
 Posts: 3175
 Joined: Wed Sep 17, 2008 2:25 pm
Re: Dummy Variables
How many dummies would you guess you can run through @expand before either the numerics break or the regression takes forever?

 Posts: 6
 Joined: Mon Nov 06, 2017 12:12 pm
Re: Dummy Variables
Thank you very much Gareth, it worked

 Posts: 6
 Joined: Mon Nov 06, 2017 12:12 pm
Re: Dummy Variables
A related question: I constructed a system of equations to estimate with Seemingly Unrelated Regressions (SUR). The system has to specified with each actual coefficient related to the associated variable, for example:
Under System Specification:
How could I add the "day of year" fixed effects to each equation in the system without specifying a particular coefficient for each dummy? This would require 365 dummies for each equation, so I was trying to do it like a simple estimation in eviews where you dont need to specify a particular coefficient for each variable but I cant find out how to do it
Under System Specification:
Code: Select all
Ycounty0 = C(1)*rain0+C(2)*clouds0+C(3)*x0+C(4)*sun0
Ycounty1 = C(5)*rain1+C(6)*clouds1+C(7)*x1+C(8)*sun1
Ycounty2 = C(9)*rain2+C(10)*clouds2+C(11)*x2+C(12)*sun2
... and so on for many counties
How could I add the "day of year" fixed effects to each equation in the system without specifying a particular coefficient for each dummy? This would require 365 dummies for each equation, so I was trying to do it like a simple estimation in eviews where you dont need to specify a particular coefficient for each variable but I cant find out how to do it

 Posts: 6
 Joined: Mon Nov 06, 2017 12:12 pm
Re: Dummy Variables
Been trying to do this for several hours, there is no way to do this right?

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

 Posts: 6
 Joined: Mon Nov 06, 2017 12:12 pm
Re: Dummy Variables
Thanks, it works for the system specification. Now there is another problem, when I try to estimate.
I have a system of 25 equations, with 3 independent variables for each. I then try to perform the estimation with the Seemingly Unrelated Regression method and it works well. But when I add fixed effects @expand(@day,@month) for each equation the system specification is fine but when I estimate there is an error saying "Matrix dimensions too large". This happens when I estimate the system using either OLS or SUR.
The error occurs even if I add @dropfirst to the expand term, to avoid possible multicolinearity. If I reduce the number of dummies by using instead @expand(@day) then the error does not occur and the estimates are executed well. Also, if I specificy the system with @expand(@day,@month) dummies having the same coefficient across all equations in the system then the error does not occur. So I guess there is a limit on the number of coefficients that you can use in a system in Eviews, or what else could be the issue? I also defined beta as the coefficient vector by running the commmand coef(20000) beta
And 20000 is well above the number of coefficients in the system specification
I have a system of 25 equations, with 3 independent variables for each. I then try to perform the estimation with the Seemingly Unrelated Regression method and it works well. But when I add fixed effects @expand(@day,@month) for each equation the system specification is fine but when I estimate there is an error saying "Matrix dimensions too large". This happens when I estimate the system using either OLS or SUR.
The error occurs even if I add @dropfirst to the expand term, to avoid possible multicolinearity. If I reduce the number of dummies by using instead @expand(@day) then the error does not occur and the estimates are executed well. Also, if I specificy the system with @expand(@day,@month) dummies having the same coefficient across all equations in the system then the error does not occur. So I guess there is a limit on the number of coefficients that you can use in a system in Eviews, or what else could be the issue? I also defined beta as the coefficient vector by running the commmand coef(20000) beta
And 20000 is well above the number of coefficients in the system specification

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11378
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Dummy Variables
Yes, you've gone beyond the limits of what the system can handle.
Follow us on Twitter @IHSEViews
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests