Page 1 of 1

Dummy Variables

Posted: Wed Feb 01, 2012 1:43 pm
by Josh
I have a dataset, let's call it x, which contains a number of integers: 1,2,3,4, and 5+. I need to create dummy variables, of X size, 1, 2 , 3, 4 and the rest of grouped into one.

Hope I've explained well enough, how do I about creating this in eviews?

Re: Dummy Variables

Posted: Wed Feb 01, 2012 2:36 pm
by EViews Gareth
I don't follow that at all.

Re: Dummy Variables

Posted: Wed Feb 01, 2012 2:38 pm
by EViews Glenn
If you just need the dummies in a regression or in a group, you can use the @expand combined an @recode.

Code: Select all

@expand(@recode(x>5, 5, x))

Re: Dummy Variables

Posted: Wed Feb 01, 2012 3:13 pm
by Josh
've been given a question to complete as part of my Econometrics class. So far I have this equation, which I know to be correct:

NETTFA=C(1)+C(2)*E401K+C(3)*INC+C(4)*INC^2+C(5)*AGE+C(6)*AGE^2+C(7)*E401K*(AGE-41)+C(8)*E401K*(AGE-41)^2

Now, the question asks me to define five family size dummy variables: fsize1, fsize2, fsize3, fsize4 and fsize5. The variable fsize5 is unity for families with give or members. Include the family size dummies in the model estimated, be sure to choose a base group.

fsize is a variable which contains data on the number of people in a house hold.

Can you explain how to add the dummy variables?

Thanks, Josh.

Re: Dummy Variables

Posted: Wed Feb 01, 2012 3:23 pm
by EViews Gareth

Re: Dummy Variables

Posted: Wed Feb 01, 2012 4:10 pm
by EViews Glenn
In this case, it's probably worth putting the @expand in context. Since your model is linear, you can specify by list which makes @expand particularly useful:

Code: Select all

equation eq1.ls nettfa c e401k inc inc^2 age age^2 e401K*(age-41) e401k*(age-41)^2 @expand(@recode(fsize>5, 5, fsize), @dropfirst)

Re: Dummy Variables

Posted: Thu Feb 02, 2012 4:29 am
by Josh
Where should I be putting this code?

Re: Dummy Variables

Posted: Thu Feb 02, 2012 8:51 am
by EViews Esther
Below the menu bar is an area called the *command* window.

Re: Dummy Variables

Posted: Thu Feb 02, 2012 10:45 am
by EViews Glenn
You may want to take a look at the first few chapters of EViews Illustrated, which may be downloaded from

http://eviews.com/illustrated/illustrated.html

Re: Dummy Variables

Posted: Thu Feb 02, 2012 4:12 pm
by Josh
Thanks, I always maximised my dataset window, never saw the command bar.