Dummy Variables

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

amal
Posts: 2
Joined: Sat Jun 13, 2015 7:40 am

Re: Dummy Variables

Postby amal » Tue Jun 16, 2015 1:47 pm

What variables should I remove?

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

Re: Dummy Variables

Postby EViews Gareth » Tue Jun 16, 2015 2:14 pm

There is no way anyone can answer that for you.
Follow us on Twitter @IHSEViews

jlbrillet
Posts: 49
Joined: Mon Feb 16, 2009 6:03 am

Re: Dummy Variables

Postby jlbrillet » Thu Jun 18, 2015 7:02 am

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.....

adnma
Posts: 12
Joined: Wed Sep 02, 2015 2:43 am

Re: Dummy Variables

Postby adnma » Wed Sep 02, 2015 10:02 am

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.....

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

Re: Dummy Variables

Postby EViews Gareth » Wed Sep 02, 2015 10:10 am

Just use @expand(industry, @dropfirst) as a regressor.
Follow us on Twitter @IHSEViews

adnma
Posts: 12
Joined: Wed Sep 02, 2015 2:43 am

Re: Dummy Variables

Postby adnma » Sun Sep 13, 2015 3:10 am

Hi Garreth!
Thanks a lot for the reply. It really helped. :D :D :D
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."

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

Re: Dummy Variables

Postby EViews Gareth » Sun Sep 13, 2015 7:52 am

@expand does something similar
Follow us on Twitter @IHSEViews

JohnM
Posts: 3
Joined: Sat Nov 21, 2015 10:23 am

Re: Dummy Variables

Postby JohnM » Sat Nov 21, 2015 10:36 am

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?

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Dummy Variables

Postby startz » Sat Nov 21, 2015 10:43 am

Yes. But why not just try it to see what happens?

JohnM
Posts: 3
Joined: Sat Nov 21, 2015 10:23 am

Re: Dummy Variables

Postby JohnM » Thu Nov 26, 2015 10:12 am

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?
Attachments
regr without dummy.wf1
(40.14 KiB) Downloaded 444 times

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Dummy Variables

Postby startz » Thu Nov 26, 2015 10:14 am

There's nothing wrong with what you've done, but instead of @expand you could simply have included dum_cash.

JohnM
Posts: 3
Joined: Sat Nov 21, 2015 10:23 am

Re: Dummy Variables

Postby JohnM » Thu Nov 26, 2015 11:19 am

Thank you very much for taking time answering me. :)

skdahems
Posts: 2
Joined: Sat Jan 23, 2016 5:57 am

Re: Dummy Variables

Postby skdahems » Sat Jan 23, 2016 6:14 am

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

startz
Non-normality and collinearity are NOT problems!
Posts: 3775
Joined: Wed Sep 17, 2008 2:25 pm

Re: Dummy Variables

Postby startz » Sat Jan 23, 2016 8:23 am

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)

skdahems
Posts: 2
Joined: Sat Jan 23, 2016 5:57 am

Re: Dummy Variables

Postby skdahems » Sun Jan 24, 2016 5:55 am

Thanks a lot,
it works, so i can at least create the dummy variables manually for all 25 countries.


Return to “Estimation”

Who is online

Users browsing this forum: No registered users and 15 guests