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

st: RE: Interaction term for dummy variables

From   "Moore, Jeffrey E" <>
To   <>
Subject   st: RE: Interaction term for dummy variables
Date   Thu, 24 Feb 2005 15:15:02 -0500

You are doing this correct.  Note that the only '1' for male*backpain is
when you actually have a male with back pain.  Thus, the coefficient
associated with this value of 1 will represents a unique effect of back
pain on males that isn't there on females.  And there's your

-----Original Message-----
[] On Behalf Of anju parthan
Sent: Thursday, February 24, 2005 2:49 PM
Subject: st: Interaction term for dummy variables

Hi All

I am running a negative binomial regression.  Majority
of the independent variables are categorical for
example gender, ethnicity, occupation, backpain
(presence=1 and absence of back pain=0) etc. So I have
dummy coded these categorical variables. For example,
gender was dummy coded as Male. I also want to create
an interaction term between some of these dummy coded
variables. For example, gender and back pain. 

Here's how I calculated the interaction term
Male*BackPain= Male x BackPain

ID      Male   BackPain  Male*BackPain

1       1       0         0 (male without back pain)
2       1       0         0 (male without back pain)
3       0       1         0 (female with back pain)
4       0       0         0 female without backpain) 
5       1       1         1 (male with back pain) 
6       1       1         1 (male with back pain)
7       1       0         0 (male without back pain)
8       0       0         0 (female without backpain)
9       1       0         0 (male without back pain)
10      0       1         0 (female with back pain)   

And I think the xi command i.e 
xi i.gender*i.backpain

gives the same result.  

However, I am concerned that if we calculate the
interaction terms by multiplying the two dummy coded
variables, in this case Male and BackPain,  we are
combining some of the categories into the same group. 

For example,in the above sample 

ID=1 &  Male*BackPain=0 represents male without back
pain, whereas 
ID=3 &  Male*BackPain=0 represents female with back
pain, and
ID=8 &  Male*BackPain=0 represents female without back

Is that right or am I missing something trivial here? 

I would really appreciate if someone can throw some
light on how to calculate the interaction terms
between dummy coded categorical variables.

Thank you for your time.


Anju Parthan, 
Doctoral Candidate, 
The University of Texas at Austin, PHAR-PHARMACY ADMIN 
Tel: (512) 459-4942; Fax: (512) 471-8762

Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses.
*   For searches and help try:

*   For searches and help try:

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