[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Richard Goldstein <richgold@ix.netcom.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: missing dummy variable |

Date |
Thu, 04 Oct 2007 09:28:41 -0400 |

Note that if you want the R-squared (e.g.) values to be comparable between the two models you should use the hascons option rather than the nocons option -- see the manual

also, another option is to have all dummies and the constant by constraining the coefficients of the set of dummies to sum to 0

Rich

Maarten buis wrote:

--- Ben John <bjworld88@googlemail.com> wrote:I am first going to explain that both models contain exactly the sameI wonder whether there is a solution to avoid missing the first dummy variable in stata programm? I need all of the dummy variables in the equations.

information, before I am going to tell you how to add all dummies.

Say we want to know how foreign and domestic cars differ with respect

to mpg. We can do that in two ways: We can do a regression of mpg on a

dummy which is 1 for foreign and 0 for domestic cars. The equation than

looks like this:

mpg = b0 + b1 * foreign

The expected mpg for foreign cars is than:

E(mpg|foreign) = b0 + b1 * 1 = b0 + b1

The expected mpg for domestic cars is than:

E(mpg|foreign) = b0 + b1 * 0 = b0

So the constant tells you the expected mpg for domestic cars and b1

tells you how much foreign cars differ from domestic cars.

An alternative would be to add a dummie for foreign cars and a dummie

for domestic cars:

mpg = b1 * foreign + b2 * domestic

The expected mpg for foreign cars is than:

E(mpg|foreign) = b1 * 1 + b2 * 0 = b1

The expected mpg for domestic cars is than:

E(mpg|foreign) = b1 * 0 + b2 * 1 = b2

So now b1 and b2 tell you the expected value of respectively foreign

and domestic cars. The two model contain exactly the same information:

Say that the mean mpg for domestic cars is 20 and is 5 more for foreign

cars is exactly the same as saying that the mean mpg is 20 for domestic

cars and 25 for foreign cars.

You may have noticed that in the second model (both dummies) I did not

have a constant in the equation, this is delibarate. If you want to

enter all dummies you have to exclude the constant. The way to do that

is to add the -noconst- option in Stata, see the example below:

*------------------ begin example ---------------

sysuse auto, clear

gen domestic = !foreign

reg mpg foreign

reg mpg foreign domestic, noconst

*------------------- end example ----------------

(For more on how to use examples I sent to the Statalist, see

http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

Hope this helps,

Maarten

-----------------------------------------

Maarten L. Buis

Department of Social Research Methodology

Vrije Universiteit Amsterdam

Boelelaan 1081

1081 HV Amsterdam

The Netherlands

visiting address:

Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/

-----------------------------------------

___________________________________________________________ Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html

*

* 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/

* * 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/

**References**:**Re: st: missing dummy variable***From:*Maarten buis <maartenbuis@yahoo.co.uk>

- Prev by Date:
**Re: st: How to select missing variables for analysis?** - Next by Date:
**Repost: instrumental variables regression with random effects GLS using cross-section data and endogenous binary independent variable** - Previous by thread:
**Re: st: missing dummy variable** - Next by thread:
**st: missing dummy variable** - Index(es):

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