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

st: Interaction term for dummy variables


From   anju parthan <[email protected]>
To   [email protected]
Subject   st: Interaction term for dummy variables
Date   Thu, 24 Feb 2005 11:48:59 -0800 (PST)

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
pain.

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.


Regards
Anju




=====
____________________________________________________________
 
Anju Parthan, 
Doctoral Candidate, 
The University of Texas at Austin, PHAR-PHARMACY ADMIN 
1 UNIVERSITY STATION A 1930, AUSTIN, TX-78712 
Tel: (512) 459-4942; Fax: (512) 471-8762




		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail
*
*   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