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: Replicating -margins,eydx()- with interactions
From 
 
Duha Altindag <[email protected]> 
To 
 
statalist <[email protected]> 
Subject 
 
st: Replicating -margins,eydx()- with interactions 
Date 
 
Fri, 3 Jun 2011 14:00:36 -0500 
Dear Stata listers:
I am having trouble replicating semi-elasticity output of
-margins,eydx()- when I use interactions.
Below is my code:
****
webuse auto,clear
g log_mpg=ln(mpg)
reg price i.foreign##c.log_mpg
margins foreign,eydx(log_mpg) atmeans
su price
di "elasticity at foreign=0:  " _b[c.log_mpg]/r(mean)
di "elasticity at foreign=1:  " (_b[c.log_mpg]+_b[1.foreign#c.log_mpg])/r(mean)
****
I know eydx calculates (dydx)*(1/y).
I am thinking the dydx (coefficients) that -margins- use to calculate
eydx must be same as those I am using. Then, the difference can be
only due to the denominator.
Should I be using a different mean instead of r(mean)?
Thanks for your consideration.
--
Duha T. Altindag
*
*   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/