Bookmark and Share

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


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

st: logit average "marginal" effect of dummy variable with predict


From   Chris <chris.stata@gmail.com>
To   statalist@hsphsun2.harvard.edu
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.
(http://www.stata.com/statalist/archive/2013-01/msg00263.html)

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?

Thanks!
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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