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

Re: st: margeff/margins discrepancy

 From Michael Mitchell To statalist@hsphsun2.harvard.edu Subject Re: st: margeff/margins discrepancy Date Sun, 25 Apr 2010 19:14:41 -0700

```Greetings

Hmmm... ran your code and I get the same coefficient and se from
-margeff- and -margins- using Stata 11, see below

. sysuse nlsw88.dta, clear
(NLSW, 1988 extract)

. probit married wage if age==45

Iteration 0:   log likelihood = -51.472515
Iteration 1:   log likelihood = -51.361168
Iteration 2:   log likelihood = -51.361168

Probit regression                                 Number of obs   =         78
LR chi2(1)      =       0.22
Prob > chi2     =     0.6370
Log likelihood = -51.361168                       Pseudo R2       =     0.0022

------------------------------------------------------------------------------
married |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
wage |  -.0189324   .0401219    -0.47   0.637    -.0975699    .0597051
_cons |    .466017    .328395     1.42   0.156    -.1776253    1.109659
------------------------------------------------------------------------------

. margeff

Average marginal effects on Prob(married==married) after probit

------------------------------------------------------------------------------
married |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
wage |  -.0071433   .0150751    -0.47   0.636      -.03669    .0224033
------------------------------------------------------------------------------

. margins, dydx(wage)

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

Expression   : Pr(married), predict()
dy/dx w.r.t. : wage

------------------------------------------------------------------------------
|            Delta-method
|      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
wage |  -.0071433   .0150751    -0.47   0.636    -.0366901    .0224034
------------------------------------------------------------------------------

Did I do something wrong not to get different results?

Michael N. Mitchell
See the Stata Tidbit of the Week at
http://www.MichaelNormanMitchell.com

On Sun, Apr 25, 2010 at 6:57 AM, Joanne W. Hsu <jwhsu@umich.edu> wrote:
>
> Here is a replicable example:
>
> sysuse nlsw88.dta, clear
> probit married wage if age==45
> margeff
> margins, dydx(wage)
>
> Here, margeff produces a standard error of .0149933 (z statistic of -0.48) whereas margins reports 0.0150751 (z statistic -0.47).  Margeff reports the same coefficients and standard errors regardless of whether version 9: probit is run or just probit.
>
> Now, if one runs the following after the probit:
>
> keep if e(sample)==1
> margeff
>
> margeff now produces the same output as margins did.
>
> Note that while these standard error differences are relatively small, I'm getting a similar discrepancy that is much larger in my own data (standard errors on an order of 3 times larger with margins than margeff).
>
> Any ideas on what's going on here?
>
>> Date: Sat, 24 Apr 2010 18:40:44 -0500
>> From: Richard Williams<Williams.NDA@comcast.net>
>> Subject: Re: st: margeff/margins discrepancy
>>
>> A replicable example, or at least seeing your code, could help.  In
>> particular, you want to be sure that the margins command really is
>> doing the same thing as margeff.
>>
>> I have found that in some instances using version control on the
>> estimation command is helpful with margeff, e.g.
>>
>> version 9: probit y x
>> margeff
>>
>> This is because margeff was written for Stata 9, and some of the
>> ereturned results from estimation commands changed in Stata 10 or 11.
>>
>> If that doesn't solve it why don't you post your code, or better yet
>> a replicable example.
>>
>>
> *
> *   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/

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