Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: Difference between using dummy variables and the '==1' command

 From Richard Williams To statalist@hsphsun2.harvard.edu, statalist@hsphsun2.harvard.edu Subject Re: st: Difference between using dummy variables and the '==1' command Date Wed, 24 Aug 2011 21:41:24 -0500

```At 09:58 AM 8/24/2011, lreine ycenna wrote:
```
```Hi all,

I compared the regression results based on two different comamnds,
namely those derived from dummy variables and the 'if female==1'
command and found that at times these results can be quite different,
though they can also be very similar in some cases. For example,
comparing results from two separate regressions - (1) 'regress A B
AxFemale BxFemale' (from which I then add up the coefficients for A
and AxFemale), and (2) 'regress A B if female==1'.  Normally, at least
I expect, the coeffcients for A and female should be very similar
under these two commands, but I am unable to explain why sometimes
these coeffcients (e.g. A and Female) are very different depending on
the method used (e.g. 0.6 v.s -0.02).  I am wondering whether this is
normal? Can anyone explain to me whether there is any significant
methodological difference between these two comamnds?
```
```
```
If I understand you correctly you are not setting this up right. The first regression should be
```
reg A B female AxFemale BxFemale

i.e. you are leaving out the main effect of female. So, try something like

sysuse auto
reg price weight foreign i.foreign#c.weight
reg price weight if foreign ==0
reg price weight if foreign ==1

```
You'll see that the first regression gives you the same results as the next two regressions, just parameterized differently.
```

-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu
WWW:    http://www.nd.edu/~rwilliam

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```