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: logit average "marginal" effect of dummy variable with predict

From   Chris <>
Subject   st: logit average "marginal" effect of dummy variable with predict
Date   Tue, 7 May 2013 13:48:50 +0200

Dear statalist,

I want to compute the average marginal effect of an interaction
effect, so I have to simultaneously "switch on and off" two treatment
dummies (one treatment dummy, and one subgroup dummy interacted with
the treatment dummy). Margins can't do that, as Richard Williams
recently pointed out here on statalist.

So I am trying to compute it manually. However, I don't even manage to
compute the average marginal effect with the predict command; somehow,
there is a discrepancy between margins and predict even for simple
cases. Does anybody know why? Example:

webuse lowbirth, clear
logit low lwt ptd smoke age
margins, dydx(smoke) //AME of smoke

replace smoke=1 //set entire sample smoke=1
predict withsmoke //predict probability
replace smoke=0 //set entire sample smoke=0
predict withoutsmoke //predict probability
gen me=withsmoke-withoutsmoke //compute discrete "marginal" effect
egen ame=mean(me) //AME of smoke

The margins command gives an AME of .2198375, while the predict
version gives .2297. Which is right and why do they differ?

*   For searches and help try:

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