# st: standard errors using MARGINS

 From "Carter Hill" To Subject st: standard errors using MARGINS Date Thu, 15 Oct 2009 10:45:20 -0500

```Hello stata users

I can replicate AME (exactly) but not standard error using MARGINS.
Using PREDICTNL we can compute observation level marginal effects and
standard errors. Average of the Marginal Effect matches output from
MARGINS. But standard error does not. I'd like to know how MARGINS is
computing its Delta Method Standard Error. Sample output below. Thanks.

. poisson art fem mar kid5 phd ment, vce(oim)

. * marginal effect of MENT observation by observation
.
. predictnl dydment = exp(_b[_cons]+_b[fem]*fem+_b[mar]*mar +
_b[kid5]*kid5 + _b[phd]*phd ///
>            + _b[ment]*ment)*_b[ment], se(dydment_se)

.
. * predicted ART difference from assuming all N female and all N male
.
. predictnl femdiff = exp(_b[_cons]+_b[fem]+_b[mar]*mar + _b[kid5]*kid5
+ _b[phd]*phd + _b[ment]*ment) ///
>                   - exp(_b[_cons]+_b[mar]*mar + _b[kid5]*kid5 +
_b[phd]*phd + _b[ment]*ment), se(femdiff_se)

.
. * AME i.FEM and dART/dMENT
.
. summarize femdiff femdiff_se dydment dydment_se

Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
femdiff |       915   -.3748107    .1342408  -1.936606  -.1879618
femdiff_se |       915     .092062    .0332046   .0459706   .5079955
dydment |       915    .0432412    .0170774   .0226905   .2459053
dydment_se |       915    .0042211    .0031078   .0021575   .0538789

.
. * compare above to use of MARGINS statement
.
. quietly poisson art i.fem mar kid5 phd ment

. *------------------------------------------
. * AME matches use of predictnl
. * but standard error does not
. *------------------------------------------
.
. margins, dydx(fem ment)

Average marginal effects                          Number of obs   =
915
Model VCE    : OIM

Expression   : Predicted number of events, predict()
dy/dx w.r.t. : 1.fem ment

------------------------------------------------------------------------
------
|            Delta-method
|      dy/dx   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+----------------------------------------------------------
------
1.fem |  -.3748107   .0900846    -4.16   0.000    -.5513733
-.1982481
ment |   .0432412   .0035694    12.11   0.000     .0362454
.0502371
------------------------------------------------------------------------
------

R. Carter Hill
Ourso Family Professor of Econometrics
www.bus.lsu.edu/hill
www.principlesofeconometrics.com

*
*   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/
```