Dummy Variables
Moderators: EViews Gareth, EViews Moderator
Re: Dummy Variables
What variables should I remove?

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12891
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Dummy Variables
Hello from Paris,
In my opinion, the easiest way of manipulating dummy variables is the following;
Create a time trend using the date and adding a fraction to the previous value in case of quarterly data.
For quarterly data over a 1980  2020 period:
smpl 1980q1 1980q1
genr t=1980
smpl 1980q2 2020q4
genr t=t(1)+0.25
Then you create "logical" dummies by stating a condition.
For instance:;
in 1984 second quarter : (t=1984.25)
starting in 1984 second quarter : (t>=1984.25)
in 1984 : (t>=1984)*(t<1985)
etc....
These logical variables do not need to be updtaed, forecasted.....
In my opinion, the easiest way of manipulating dummy variables is the following;
Create a time trend using the date and adding a fraction to the previous value in case of quarterly data.
For quarterly data over a 1980  2020 period:
smpl 1980q1 1980q1
genr t=1980
smpl 1980q2 2020q4
genr t=t(1)+0.25
Then you create "logical" dummies by stating a condition.
For instance:;
in 1984 second quarter : (t=1984.25)
starting in 1984 second quarter : (t>=1984.25)
in 1984 : (t>=1984)*(t<1985)
etc....
These logical variables do not need to be updtaed, forecasted.....
Re: Dummy Variables
Hi!
In my panel data set, I have the data in the following format
Year Company Industry
2010 ABC Pharma
2011 ABC Pharma
2012 ABC Pharma
2010 DEF Electricals
2011 DEF Electricals
2012 DEF Electricals
2010 MNO Finance
2011 MNO Finance
2012 MNO Finance
I want to create industry dummies for each of the industry groups, so that in my regression I can find industry effects
Could anybody suggest a method by which I can do so???
Thanks in advance.....
In my panel data set, I have the data in the following format
Year Company Industry
2010 ABC Pharma
2011 ABC Pharma
2012 ABC Pharma
2010 DEF Electricals
2011 DEF Electricals
2012 DEF Electricals
2010 MNO Finance
2011 MNO Finance
2012 MNO Finance
I want to create industry dummies for each of the industry groups, so that in my regression I can find industry effects
Could anybody suggest a method by which I can do so???
Thanks in advance.....

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12891
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Dummy Variables
Just use @expand(industry, @dropfirst) as a regressor.
Follow us on Twitter @IHSEViews
Re: Dummy Variables
Hi Garreth!
Thanks a lot for the reply. It really helped.
However, I have another question for the same data set. I now need to control for "industry effects and "time effects" (both together).
If we use STATA, the approach is as below: (My doubt is that HOW DO I REPLICATE THE BELOW METHODOLOGY IN EVIEWS ). Kindly advice me in this regard.....
"In STATA, you can use the xi functionality that's built in. Let industry be a variable indicating the industry of each observation and year being the year variable. If you have a simple regression of y on x, then adding the industry and year fixed effects is as simple as
xi: regress y x i.industry i.year
The command xi says that there is some x variable that you want to become a set of dummy or indicator variables based on each different value the variable can have. The i. simple tells STATA which variables you would like to transform.
STATA automatically drops one of the created dummy/indicator variables so that your model does not suffer from exact multicollinearity."
Thanks a lot for the reply. It really helped.
However, I have another question for the same data set. I now need to control for "industry effects and "time effects" (both together).
If we use STATA, the approach is as below: (My doubt is that HOW DO I REPLICATE THE BELOW METHODOLOGY IN EVIEWS ). Kindly advice me in this regard.....
"In STATA, you can use the xi functionality that's built in. Let industry be a variable indicating the industry of each observation and year being the year variable. If you have a simple regression of y on x, then adding the industry and year fixed effects is as simple as
xi: regress y x i.industry i.year
The command xi says that there is some x variable that you want to become a set of dummy or indicator variables based on each different value the variable can have. The i. simple tells STATA which variables you would like to transform.
STATA automatically drops one of the created dummy/indicator variables so that your model does not suffer from exact multicollinearity."

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12891
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Dummy Variables
hello,
being new to eviews, I have some issues creating dummy variables.
I want to create a dummy variable (1=cash 0=all other). I generated and defined them on my own
In regression, I used @expand(cash) and at first i had the collinear probelm. I looked at this http://www.eviews.com/Learning/dummies.html, and removed the constant.
If i want to include the constant to the regression, I read here that I have to use the @expand(cash, @dropfirst). This would regress Y with the constant, with Xs and with my dummy?
being new to eviews, I have some issues creating dummy variables.
I want to create a dummy variable (1=cash 0=all other). I generated and defined them on my own
In regression, I used @expand(cash) and at first i had the collinear probelm. I looked at this http://www.eviews.com/Learning/dummies.html, and removed the constant.
If i want to include the constant to the regression, I read here that I have to use the @expand(cash, @dropfirst). This would regress Y with the constant, with Xs and with my dummy?

 Nonnormality and collinearity are NOT problems!
 Posts: 3699
 Joined: Wed Sep 17, 2008 2:25 pm
Re: Dummy Variables
Yes. But why not just try it to see what happens?
Re: Dummy Variables
This is my file.
I created the dum_cash dummy variable with the generate (dum_cash = 0) and then I edited it and put the value 1 to the transactions with cash.
I want to run a regression of cars_y with all the other variables, including the dummy and the constant. The estimation command I use is " LS CARS_Y_ C ROE_X1_ LN_MV TOTAL_DEBT_COMMON_EQUITY MARKET_VALUE_TO_BOOK__X5 PE_X6_ @EXPAND(DUM_CASH, @DROPFIRST) ".
I believe that it is not correct to use the @dropfirst.
What is my alternative?
I created the dum_cash dummy variable with the generate (dum_cash = 0) and then I edited it and put the value 1 to the transactions with cash.
I want to run a regression of cars_y with all the other variables, including the dummy and the constant. The estimation command I use is " LS CARS_Y_ C ROE_X1_ LN_MV TOTAL_DEBT_COMMON_EQUITY MARKET_VALUE_TO_BOOK__X5 PE_X6_ @EXPAND(DUM_CASH, @DROPFIRST) ".
I believe that it is not correct to use the @dropfirst.
What is my alternative?
 Attachments

 regr without dummy.wf1
 (40.14 KiB) Downloaded 341 times

 Nonnormality and collinearity are NOT problems!
 Posts: 3699
 Joined: Wed Sep 17, 2008 2:25 pm
Re: Dummy Variables
There's nothing wrong with what you've done, but instead of @expand you could simply have included dum_cash.
Re: Dummy Variables
Thank you very much for taking time answering me.
Re: Dummy Variables
Hey there,
i have monthly panel data from 2003 to 2013 for 25 countries. I want to estimate a fixed effects model with a shift in coefficients during the financial crisis. So i need a dummy variable for each country just for the crisis period to estimate the fixed effects for the crisis. For example for Spain from 2008M10 to 2013M12 the values are equal to one and all other values are 0.
A for loop with something like this:
series crisis = @recode (@date>@dateval("2008m9"), 1, 0)
but with the crossid selction.
Can you help me?
Thanks a lot
i have monthly panel data from 2003 to 2013 for 25 countries. I want to estimate a fixed effects model with a shift in coefficients during the financial crisis. So i need a dummy variable for each country just for the crisis period to estimate the fixed effects for the crisis. For example for Spain from 2008M10 to 2013M12 the values are equal to one and all other values are 0.
A for loop with something like this:
series crisis = @recode (@date>@dateval("2008m9"), 1, 0)
but with the crossid selction.
Can you help me?
Thanks a lot

 Nonnormality and collinearity are NOT problems!
 Posts: 3699
 Joined: Wed Sep 17, 2008 2:25 pm
Re: Dummy Variables
skdahems wrote:Hey there,
i have monthly panel data from 2003 to 2013 for 25 countries. I want to estimate a fixed effects model with a shift in coefficients during the financial crisis. So i need a dummy variable for each country just for the crisis period to estimate the fixed effects for the crisis. For example for Spain from 2008M10 to 2013M12 the values are equal to one and all other values are 0.
A for loop with something like this:
series crisis = @recode (@date>@dateval("2008m9"), 1, 0)
but with the crossid selction.
Can you help me?
Thanks a lot
Maybe
Code: Select all
series crisis = @recode (@date>@dateval("2008m9") and country="Spain", 1, 0)
Re: Dummy Variables
Thanks a lot,
it works, so i can at least create the dummy variables manually for all 25 countries.
it works, so i can at least create the dummy variables manually for all 25 countries.
Who is online
Users browsing this forum: Google [Bot] and 7 guests