Dummy Variables

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

Josh
Posts: 10
Joined: Wed Jan 18, 2012 5:01 am

Dummy Variables

Postby Josh » Wed Feb 01, 2012 1:43 pm

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?

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

Re: Dummy Variables

Postby EViews Gareth » Wed Feb 01, 2012 2:36 pm

I don't follow that at all.

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Dummy Variables

Postby EViews Glenn » Wed Feb 01, 2012 2:38 pm

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

Josh
Posts: 10
Joined: Wed Jan 18, 2012 5:01 am

Re: Dummy Variables

Postby Josh » Wed Feb 01, 2012 3:13 pm

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

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

Re: Dummy Variables

Postby EViews Gareth » Wed Feb 01, 2012 3:23 pm


EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: Dummy Variables

Postby EViews Glenn » Wed Feb 01, 2012 4:10 pm

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)

Josh
Posts: 10
Joined: Wed Jan 18, 2012 5:01 am

Re: Dummy Variables

Postby Josh » Thu Feb 02, 2012 4:29 am

Where should I be putting this code?

EViews Esther
EViews Developer
Posts: 149
Joined: Fri Sep 03, 2010 7:57 am

Re: Dummy Variables

Postby EViews Esther » Thu Feb 02, 2012 8:51 am

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

Postby EViews Glenn » Thu Feb 02, 2012 10:45 am

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

Josh
Posts: 10
Joined: Wed Jan 18, 2012 5:01 am

Re: Dummy Variables

Postby Josh » Thu Feb 02, 2012 4:12 pm

Thanks, I always maximised my dataset window, never saw the command bar.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests