# Re: st: Assessing true odds ratios in logistic regression models with interaction terms

 From Maarten buis To Ashwin Ananthakrishnan , statalist@hsphsun2.harvard.edu Subject Re: st: Assessing true odds ratios in logistic regression models with interaction terms Date Thu, 9 Mar 2006 19:31:27 +0000 (GMT)

```Ashwin,

I have also sent this reply to the statalist, since people also (should) use the statalist
archieve to find answers to their questions, and there is nothing so frustrating as finding a
the archive.

The trick about interpreting interaction terms is to write out the equation, So
log(odds) = b0 + b1*_Igro1 + b2_Igro2 + b3*tn + b4*_Igro1Xtn + b5*_Igro2Xtn +
b6*gpa + b7*_Igro1Xgpa + b8*_Igro2Xgpa

I have abreviated topnotch to tn to simplify notation, and I have used variable names that -xi-
would produce, since you appear to be familiar with that. It is good to remember however that
there is nothing mysterious about these variables: _Igro1 is just a dummy variable with value 1 if
an individual is a member of the middle group and zero otherwise, _Igro1Xtn is just that dummy
multiplied with tn.

For the bottom group the variables _IgroI _Igro2 _IgroIXtn _Igro2Xtn _Igro1Xgpa and _Igro2Xgpa are
all zero, so the equation simplifies to:

log(odds) = b0 + b3*tn + b6*gpa

and the odds ratio for tn for the bottom group is exp(b3)

For the middle group the variables _Igro2 _Igro2Xtn and _Igro2Xgpa are all zero, _Igro1 equals 1,
_gro1Xtn is 1*tn and _Igro1Xgpa is 1*gpa, so the equation simplifies to:

log(odds) = b0 + b1*1 + b3*tn + b4*1*tn + b6*gpa + b7*1*gpa

which can be further simplified as:

log(odds) = b0 + b1 + (b3+b4)*tn + (b6+b7)*gpa

so the odds ratio for tn for the middle group is exp(b3+b4)

For the top group the variables _Igro1 _Igro1Xtn and _Igro1Xgpa are all zero, _Igro2 equals 1,
_gro2Xtn is 1*tn and _Igro2Xgpa is 1*gpa, so the equation simplifies to:

log(odds) = b0 + b2*1 + b3*tn + b5*1*tn + b6*gpa + b8*1*gpa

which can be further simplified as:

log(odds) = b0 + b1 + (b3+b5)*tn + (b6+b8)*gpa

so the odds ratio for tn for the middle group is exp(b3+b5)

If you compare this result with the program I sent you, than you will see that adding an
interaction between group and gpa does not require you to change that program. Furthermore if you
interect group with all variables than you could just as well estimate seperate regressions on
each group.

However I reiterate my comments about comparing groups with logistic regression, and urge you to
read the references I supplied you in my earlier post.

HTH,
Maarten

--- Ashwin Ananthakrishnan <ashwinna@yahoo.com> wrote:
> I have a quick question about it though - suppose in
> to the interaction with topnotch, is there any command
> in stata to give the odds ratios or coeffiecients for
> the outcome while controlling for that interaction? Or
> should I just run the regressions separately in each
> strata after stratifying by topnotch?

Maarten Buis wrote:
> ------------------------------------------------------
>
> Ashwin:
> Take the example below: the -nlcom- command gives you
> the odds ratios
> (and standard errors and
> confidence intervals) of being admitted versus not
> notch versus non topnotch for
> the three groups of students while controling for gpa.
>
>
> However comparing groups with logistic is a
> particularly sticky issue.
> This command is only true
> if you have observed all relevant variables, or if the
> unobserved
> variables are equally variable
> in the bottom, middle and top group of students. If
> this is not the
> case than this comparison is
> problematic. See (Allison 1999) and (Hoetker 2003) for
> and attempts to solve this
> problem.
>
> *--------------begin example-----------------
> use http://www.ats.ucla.edu/stat/stata/dae/logit.dta, clear
> egen group = cut(gre), group(3)
> xi: logit admit i.group*topnotch gpa
> nlcom (bottom: exp(_b[topnotch])) /*
>   */  (middle: exp(_b[topnotch] + _b[_IgroXtopno_1])) /*
>   */  (top:    exp(_b[topnotch] + _b[_IgroXtopno_2]))
> *--------------end example-----------------
>
> Allison, Paul D. (1999) Comparing Logit and Probit
> Coefficients Across
> Groups. Sociological
> Methods & Research, 28(2), pp. 186-208
>
> Hoetker, Glenn (2003) Confounded Coefficients:
> Accurately Comparing
> Logit and
> Probit Coefficients Across Groups
>
> HTH,
> Maarten
>
> --- Ashwin Ananthakrishnan <ashwinna@yahoo.com> wrote:
> <snip>
>
> > The final model should look like this
> >
> > .xi: logisitic screentest gender educn income agecat
> > i.gender*i.educn i.gender*i.income i.gender*i.agecat
>
> <snip>
>
> > Now, if i want the true odds ratios for gender (ie.
> > male vs. female), what command do I use to estimate
> > this from the model?
> >
> > I want my output table to look something like
> this...
> >
> >
> > Income           OR for male vs. female
> > ----------------------------------------
> > Income1               OR1
> > Income 2              OR2
> > Income 3              OR3
> > ----------------------------------------
> >
> > This OR should be adjusted for age, gender, educn,
> and
> > the interaction between gender and age, and gender
> and
> > educn.
> >

-----------------------------------------
between 1/2/2006 and 31/3/2006 I will be
visiting the UCLA, during this time the
best way to reach me is by email

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

Buitenveldertselaan 3 (Metropolitan), room Z214

+31 20 5986715

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

___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
*
*   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/
```