Bookmark and Share

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Why -margins- does not present marginal effects for interaction terms

From   Richard Williams <>
Subject   st: Why -margins- does not present marginal effects for interaction terms
Date   Mon, 07 Jan 2013 16:12:44 -0500

I asked Stata Tech support why the -margins- command does not produce marginal effects for interaction terms. They said I was free to forward this to the list. I think this is very consistent with what I and others have been saying the last few days, and with what I have said at

I think they are basically saying that yes, you could compute a marginal effect for an interaction term, and it wouldn't be wrong, but would you really want to? There are better ways of getting at the things researchers are really interested in.

From: Stata Technical Support <>
To: Richard Williams <>
Date: Mon, 7 Jan 2013 14:15:13 -0500
Subject: Re: Marginal effects of interaction terms

Dear Richard,

From our experience, when users ask for "interaction effects", they are mostly
interested in some way to explain or visualize the interaction.

As you pointed out, the philosophy behind -margins-, is that you enter actual
variables in your model, and you compute the effects of those actual variables
on the prediction. If your model includes x1, x2, and x1*x2, the variables in
your model are x1 and x2.

-margins-, with the option -dydx()-, answers questions like the following:

        If I increment x1 on one unit, how much will my prediction be

We can't change x1*x2 without also making changes to x1 and x2, so it is
impossible to try to explain the effect of x1*x2 in isolation of x1 and x2.

Usually, when a researcher wants to see how two variables interact, the most
natural way to do that is to use -margins- with a range of values specified in
the -at()- option, then follow it up with a call to -marginsplot-.  For
example, the following shows how sex and age affect the marginal predicted
probability of a positive outcome:

        . webuse nhanes2, clear
        . logit heartatk age age c.age#c.age bmi
        . margins sex, at(age = (20(5)75))
        . marginsplot

Besides the documentation in -[R] margins- and -[R] marginsplot-, there is
also a nice article about this in the last issue of the Stata News, available

We are aware that there are other takes to the construction of marginal
effects, and some authors report a second derivative as the marginal effect
due to the interaction between two continuous variables.  We find nothing
wrong with this practice, except that a single number rarely tells the whole
story in this case.  It was for this reason and our belief that most
researchers are interested in other things that we decided to only implement
effects based on first order derivatives in -margins-.

With the addition of -contrast- and contrast operators in -margins- in Stata
12, it is possible to compute all the discrete interaction effects.  The
contrast operators can be combined with continuous variables in the -dydx()-
option to compute effects of interactions that also contain a single
continuous variable.



Isabel Canette, Ph.D.
Senior Statistician
StataCorp LP

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

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index