I wonder why my two versions of marginal effects (AME and MEM) yield identical results:

webuse nlswork, clear
xtset idcode year

xtreg ln_wage age c.age#c.age ttl_exp c.ttl_exp#c.ttl_exp tenure c.tenure#c.tenure, fe

margins, dydx(age)
margins, dydx(age) atmeans

             |            Delta-method
             |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
         age |  -.0063896   .0009607    -6.65   0.000    -.0082725   -.0045066

Merely the headline is different ("average" vs. "conditional" marginal effect). Thank you


1 Answer 1


In your first command (AME), you are asking margins to calculate the derivative of the expectation with respect to age for each person and then take the average. That derivative is function of (1) age and (2) the coefficients on age and age^2, namely _b[age] + 2*_b[c.age#c.age]*age. It is a linear function of age.

So it does not matter if you ask Stata to average _b[age] + 2*_b[c.age#c.age]*age in your sample, or if you tell Stata to plug in the average age into that formula and then take the in-sample average (the MEM in the second margins).

The second average is redundant here, but it makes some sense in more complicated settings where you want to set some variables to the mean and leave others alone, or if your derivative is more complicated/nonlinear.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.