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?
Dummy Variables
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Dummy Variables
I don't follow that at all.
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Dummy Variables
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
'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.
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.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Dummy Variables
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
Where should I be putting this code?
-
EViews Esther
- EViews Developer
- Posts: 149
- Joined: Fri Sep 03, 2010 7:57 am
Re: Dummy Variables
Below the menu bar is an area called the *command* window.
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Dummy Variables
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
http://eviews.com/illustrated/illustrated.html
Re: Dummy Variables
Thanks, I always maximised my dataset window, never saw the command bar.
Who is online
Users browsing this forum: No registered users and 1 guest
