Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: Re: Stata tip 87: Interpretation of interactions in non-linear models

 From Maarten Buis To statalist@hsphsun2.harvard.edu Subject st: Re: Stata tip 87: Interpretation of interactions in non-linear models Date Mon, 16 May 2011 11:06:55 +0200

```Quoting  André Ebner:
> question in this regard.
>
> As I tried to use your approach with my data I encountered an
> inconsistency I cannot explain.
>
> using
> xtlogit y x1 x2 x3 ... i.inc_shock#i.loan_const, or re
> I am interested in the odds-ratio for the interaction term mentioned above
> (between income shock and loan constrained).

This is in fact a ratio of odds ratios.

> As result for the interaction term I obtain: 41.607 (p-val: 0.065),
> meaning that the effect of an income shock is 41 times higher for a person
> who is loan constrained compared to someone who is not.
>
> Trying to related this to the baseline odds I proceeded as in your Stata tip:
> margins, over(inc_shock loan_const) expression(exp(xb())) post
>
> Predictive margins		Number	of obs   =	1044
> Model VCE    : OIM
>
> Expression   : exp(xb())
> over         : inc_shock loan_const
>
>
> Delta-method
> Margin   Std. Err.	z	P>z	[95% Conf.	Interval]
>
> inc_shock#loan_const
> 0 0     .0840394   .0389736	2.16	0.031	.0076525	.1604262
> 0 1     .1141765   .1041668	1.10	0.273	-.0899868	.3183397
> 1 0     .0239335   .0301342	0.79	0.427	-.0351284	.0829954
> 1 1     .7056188   .9974767	0.71	0.479	-1.2494	        2.660637
>
> So (0.70/0.114) / (0.023/0.084)  should give 41.607, however it is only 22.59
>
> I tried to figure out where the error is, but couldn't come up with an
> explanation. Even the fact that the specification is a RE model shouldn't
> play a role, I guess. expression(exp(xb()) should also take account for
> the other covariates I use besides inc_shock and loan_const.

Your intuition is correct, the trick is to use the -at()- option in
-margins-. This is not as restrictive as it seems, as it does not
matter at which value you fix the other covariates. You will always
get the right odds ratio or ratio of odds ratios as long as you fix
it. The difference between fixing the other covariates and not fixing
the other covariates comes from the fact that  without fixing you get
the odds averaged over your other control variables, while the
logistic regression model is based on odds before averaging. This is
illustrated in the example below:

*------------------------ begin example ------------------------------------
sysuse nlsw88, clear
gen byte high_occ = occupation < 3 if occupation < .
gen byte black = race == 2 if race < .
drop if race == 3
gen byte baseline = 1
sum ttl_exp
gen c_ttl_exp = ttl_exp - r(mean)

// fix at average ttl_exp (12.5 years)
logit high_occ black##collgrad c_ttl_exp baseline, or nocons
at(c_ttl_exp = 0) post

// fix at 22.5 years
qui logit high_occ black##collgrad c_ttl_exp baseline, or nocons
at(c_ttl_exp = 10) post

*-------------------------- end example ------------------------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )

> I would be very grateful if you could help me in this regard. I am also
> wondering whether I should worry about the insignificant p-values in the
> table. I hope odds-ratios are a way to present the effect of interaction
> terms in non-linear RE models, as calculating average partial effects
> proves difficult.

That is not necessarily a problem, the significance tests in your
-margins- output refer to the odds. Odds can differ significantly even
when both odds are themselves not significantly different from 0. For
example, see (Gelman & Stern 2006). Here you don't even look at this
ratio of odds, but at the ratio of odds ratios.

Hope this helps,
Maarten

Maarten L. Buis (2010) "Stata tip 87: Interpretation of interactions
in non-linear models", The Stata Journal, 10(2), pp. 305-308.

Andrew Gelman & Hal Stern (2006) "The Difference Between `Significant'
and `Not Significant' is not Itself Statistically Significant" The
American Statistician, 60(4): 328--331.

--
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------

*
*   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/
```