Statalist The Stata Listserver


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

Re: st: why regress drops dummy variables


From   "Michael S. Hanson" <[email protected]>
To   [email protected]
Subject   Re: st: why regress drops dummy variables
Date   Tue, 2 Jan 2007 09:46:44 -0500

On Jan 2, 2007, at 9:20 AM, Rajesh Tharyan wrote:

char sex[omit]m
xi: regress car mcap no i.director i.sex i.director*i.sex


car | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
------------- +--------------------------------------------------------------
--
mcap | -.0031127 .000147 -21.17 0.000 -.0034009
-.0028245
no | .0030767 .0001176 26.17 0.000 .0028463
.0033072
_Idirector_2 | -.00387 .0006057 -6.39 0.000 -.0050571
-.0026829
_Isex_1 | .0004936 .0023094 0.21 0.831 -.0040328
.00502
_Idirector_2 | (dropped)
_Isex_1 | (dropped)
_IdirXsex_~1 | .0007891 .0031731 0.25 0.804 -.0054303
.0070085
_cons | .0035362 .0015175 2.33 0.020 .0005619
.0065106

I do not understand why the dummy variables are dropped (are they dropped?).
	Yes, they are surely dropped as Stata says they are dropped!


Is there a solution to this?
Yes, use the command:

xi: regress car mcap no i.director*i.sex

As you will note from -help xi-, the above interaction term "Creates dummies for categorical variables ... and all interactions and main effects." That is, by putting "i.director*i.sex" in your -xi: regress- command, Stata automatically expanded that expression to include "i.director" and "i.sex" individually (the "main effects") as well as the interaction term you had intended. Thus, because you already separately included "i.director" and "i.sex" as regressors, they appeared in the regression twice and Stata had to drop one of their occurrences each. This is clearly indicated in your -regress- output, quoted above.

Why does Stata do this? I suspect it is to protect less sophisticated users from including only interaction terms without the main terms... unless they really know what they are doing.[*] As your example demonstrates, it is relatively uncommon for someone to want to do that. Hope this helps.

-- Mike

[*] As far as I can tell, it is not possible to include only the interaction term and not the main terms for two categorical (dichotomous) variables using the -regress...- command with the -xi:- prefix. Rather, one must first create the interaction terms with -xi- as a command, then include only the interaction term(s) in the specification of -regress-. It might be possible to accomplish the inclusion of *just* the interaction terms with the following syntax:

xi: regress car mcap no i.director|sex

but as I do not have access to a database on which to test such a specification, that remains a conjecture (and exercise for the reader).

*
* 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index