Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# st: margins dydx for logit model with interaction terms

 From David Quinn To statalist@hsphsun2.harvard.edu Subject st: margins dydx for logit model with interaction terms Date Thu, 9 Aug 2012 12:30:37 -0400

```Hello,

I am estimating a logit model as such: Y=X1 + X2 + X3 + X4 + X1*X3 + X2*X3.

X1 and X2 are binary predictors.  X3 is an ordinal predictor.  X4 is a
control variable.  X1*X3 and X2*X3 are the interaction of X1 and X2,
respectively, with X3.

I'd like to assess the discrete change in my dependent variable for X1
at different levels of X3, given that I expect there to be interaction
effects of X1 and X3.   I also need to set X2 and X2*X3 at zero while
doing this in order to calculate the proper discrete change of
interest.  As for the control variable X4, I'd like to just keep it at
its mean value.

I used the following margins command to calculate the discrete change in X1:

margins, dydx(X1) atmeans at(X3=(1 2 3) X1*X3=(1 2 3) X2=0 X2*X3=0)

"Atmeans" places X4 at its mean, while the stuff after "at" specifies
the specific values at which to hold the other variables while
calculating the change.

But in the legend that accompanies the results, it keeps saying that
X1 is being held at its mean value when the discrete change
calculations are being made.  Why does margins set the variable of
interest--located after the dydx command--to its mean value when
calculating the discrete change, when clearly one would want the dydx
calculations to be made at specific values of the variable of
interest?  I just assumed that placing the variable of interest after
dydx would tell Stata to calculate the change in Y as that variable
moves from zero to one, holding all other variables at the values
specified after "at."

Am I doing something incorrectly?

Perhaps I should just use King et al.'s CLARIFY package to calculate
the predicted probabilities, or perhaps even follow Buis' (2010)
advice and calculate the odds.  From what I gather, those two are a
bit more straightforward then using the margins command.