Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: How does margins get semi-elasticity eydx here?


From   Skipper Seabold <[email protected]>
To   [email protected]
Subject   st: How does margins get semi-elasticity eydx here?
Date   Wed, 30 Dec 2009 22:50:32 -0500

If eydx is defined as dy/dx * (1/y), then I don't understand how the
following values are found by margins (using Stata 11):

use http://www.ats.ucla.edu/stat/stata/examples/greene/tbl19-1, clear
logit grade gpa tuce psi

<snip>

margins, eydx

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

Expression   : Pr(grade), predict()
ey/dx w.r.t. : gpa tuce 1.psi

------------------------------------------------------------------------------
            |            Delta-method
            |      ey/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        gpa |   1.854637   .8479031     2.19   0.029     .1927771    3.516496
       tuce |   .0624472   .0930901     0.67   0.502    -.1200061    .2449006
      1.psi |   1.554903   .7283702     2.13   0.033      .127324    2.982483
------------------------------------------------------------------------------


Presumably it would give something like the following, if I had
treated psi as continuous (Please excuse the hackish mata.  I'm still
learning my way around...).  Are the missing values (NaNs or Infs,
depending on your take) handled in some odd way or is something
entirely different going on?  I didn't see anything in the manual on
this or with a (quick) google search.

mata
exog = st_data(., ("gpa", "tuce", "psi"))
stata(". gen cons = 1")
cons = st_data(., "cons")
exog = (exog,cons)
params = st_matrix("e(b)")'
xb = exog * params
pdf = exp(-xb):/(1:+exp(-xb)):^2
dydx = pdf * params'
endog = st_data(., ("grade"))
mfx = mean(effects :/ endog)
end

Any clarifications or further references would be appreciated.

Cheers,
Skipper

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index