Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: about dummy variables


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: about dummy variables
Date   Thu, 17 Mar 2005 17:31:41 -0000

I agree largely with Daniel here, although 
a bigger difficulty is that I don't understand
your specific questions. 

Nevertheless given your code note that 
you could define your dummies much more concisely:

First, 

if year==1986 | year==1987 | year==1988 | year==1989 |
year==1990 | year==1991 | year==1992 | year==1993 | year==1994 |
year==1995

collapses to 

if inrange(year, 1986, 1995) 

so that the code then looks like 

gen pre96=0
replace pre96= 1 if inrange(year, 1986, 1995) 

Second, that in turn collapses to 

gen pre96 = inrange(year, 1986, 1995) 

Similarly 

gen pos86 = inrange(year, 1996, 2002)  

However, it would seem that you wouldn't 
normally need both these dummies. 

Nick 
n.j.cox@durham.ac.uk 

Tae Hun Kim
 
> Yes, I know this question is not directly related to State program.
> But I need someone's help to understand the problem.
> 
> The Ststa code to generate dummy variables is
> **dummy variable
> gen pre96=0; 
> replace pre96=1 if year==1986 | year==1987 | year==1988 | year==1989 |
> year==1990 | year==1991 | year==1992 | year==1993 | year==1994 |
> year==1995;
> gen  post96=0;
> replace pos96=1 if year==1996 | year==1997 | year==1998 | year==1999 |
> year==2000 | year==2001 | year==2002;
> 
> **interactive term
> gen pre96s=pre96*smom;
> gen post96s=post96*smom;


Daniel Lawson 

> > This doesn't sound like a Stata-specific question.  You 
> might get more
> > or better responses to this question if you asked this question in
> > another forum.
> > 
> > In terms of Stata code, how did you generate your dummy variable?

Tae Hun Kim 

> > > I would be greatfull if someone helps me to understand 
> dummy variables.
> > >
> > > For example,
> > > Y= a+b*X+c*dum+d*(X*dum)+e
> > > where Y : income,  X : education(years),  dum=dummy 
> variable (dum=1 if
> > > male, dum=0 if female)
> > >
> > > If I estimate this equation using OLS, recalulated 
> coefficents are the
> > > same regardless of whether dum=1 if male (0 otherwise) or 
>  dum=1 if
> > > female(0 otherwise).
> > > i.e.  if I define a dummy variable as dum=1 if male, o otherwise
> > >      male(1) : E(Y)= (a+c)+(b+d)X,  female(1) : E(Y)=a+bX
> > >       if I define a dummy variable as dum=1 if female, o otherwise
> > >      male(2) : E(Y)=a+bX,              female(2) : E(Y)= 
> (a+c)+(b+d)X
> > > =>the coefficients of male(1) and male(2) equation are the same.
> > >
> > > (Question)
> > > 1. But when I estimate this equation using GMM or IV, the 
> coefficients
> > > of male(1) and male(2) equation are not the same. Why?
> > > 2. If the coefficient are different, what is the criteria 
> to define a
> > > dummy variable(male=1 or female=1) ?
> > >

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index