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]

Re: st: margeff and margins puzzle


From   Richard Williams <[email protected]>
To   [email protected], [email protected]
Subject   Re: st: margeff and margins puzzle
Date   Thu, 28 Jul 2011 21:11:41 -0500

At 06:35 PM 7/28/2011, Patrick Roland wrote:
Hi all,

Here's a piece of code which gives peculiar results. It's a simple probit.
"margeff" calculates the marginal effect to be exactly zero, whereas margins
(correctly) doesn't. The really puzzling thing is that if "set obs 1000" is
changed to "set obs 100", they give identical results, as they should!
Anyone have any idea what might be going on here?


set seed 1
set obs 1000
gen x0 = -.25
gen x1 = runiform()
gen eps = rnormal()
gen y = x0+x1+eps > 0
probit y x1
margeff
margins, dydx(*)

I get identical results with both commands. As always, make sure you have the latest versions of everything and try again.

. set seed 1

. set obs 1000
obs was 0, now 1000

. gen x0 = -.25

. gen x1 = runiform()

. gen eps = rnormal()

. gen y = x0+x1+eps > 0

. probit y x1

Iteration 0:   log likelihood = -669.63431
Iteration 1:   log likelihood = -637.00519
Iteration 2:   log likelihood = -636.94994
Iteration 3:   log likelihood = -636.94994

Probit regression                                 Number of obs   =       1000
                                                  LR chi2(1)      =      65.37
                                                  Prob > chi2     =     0.0000
Log likelihood = -636.94994                       Pseudo R2       =     0.0488

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          x1 |   1.133848   .1423649     7.96   0.000     .8548182    1.412878
       _cons |  -.2788769   .0797004    -3.50   0.000    -.4350869    -.122667
------------------------------------------------------------------------------

. margeff

Average partial effects after probit
      y  = Pr(y)

------------------------------------------------------------------------------
    variable |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          x1 |   .4126165   .0466284     8.85   0.000     .3212265    .5040065
------------------------------------------------------------------------------

.
. margins, dydx(*)

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

Expression   : Pr(y), predict()
dy/dx w.r.t. : x1

------------------------------------------------------------------------------
             |            Delta-method
             |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
          x1 |   .4126127   .0466285     8.85   0.000     .3212225    .5040028
------------------------------------------------------------------------------



-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  [email protected]
WWW:    http://www.nd.edu/~rwilliam

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


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