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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
AW: st: how to get marginal effect when dependent variable has ln function? |

Date |
Sun, 21 Jun 2009 17:17:13 +0200 |

<> "(see also help for -ivpois- on SSC)" Pages 22 ff. of http://www.stata.com/meeting/snasug08/nichols_gmm.pdf may also help... HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Austin Nichols Gesendet: Sonntag, 21. Juni 2009 17:11 An: statalist@hsphsun2.harvard.edu Betreff: Re: st: how to get marginal effect when dependent variable has ln function? Rose <gjhxmu@sina.com>: It's not entirely clear what you want. Each observation may have a different marginal effect of x1 on y; did you want the marginal effect of x1 on mean y at various levels of x, or the mean marginal effect of x1 on y, or something else? An easier way to proceed is to recognize that a Poisson regression of y on x is much like a regression of lny on x (see also help for -ivpois- on SSC or use -glm- with a log link), and -mfx- after -poisson- gives you an estimate of mean dy/dx (sort of) by default. The answer you get by calculating the mean marginal effect of x on y after regress lny x should be similar to a Poisson-based answer--assuming no interactions, just calculate the sample mean of the coef times the untransformed depvar (but note that the dydx you calculate may be skewed etc and the mean dydx may not be a good way to characterize the typical marginal effect or the range of marginal effects, which may be better characterized via a graph of some kind): clear sysuse auto g lny=ln(mpg) g x=weight/1000 poisson mpg x, r mfx reg lny x, r g dydx=_b[x]*mpg if e(sample) su dydx sc dydx x sc dydx mpg, name(vsy) If you have interactions on the RHS, it becomes trickier, since -mfx- does not produce the right results, but you can still use calculus: dy/dx is y times d(lny)/dx so if you have reg lny x xz z then g dydx=y*(_b[x]+_b[xz]*z) if e(sample) su dydx 2009/6/21 <gjhxmu@sina.com> > > Dear statalists, > I have an equation below: > lny=a0+a1*x1+a2*x2+e > > and I typed below in the stata: > > g lny=ln(y) > reg lny x1 x2 > > However, how can I get the marginal effect of x1 on y? > > Thank you a lot! > > Sincerely, > from Rose * * 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/

**References**:**st: how to get marginal effect when dependent variable has ln function?***From:*gjhxmu@sina.com

**Re: st: how to get marginal effect when dependent variable has ln function?***From:*Austin Nichols <austinnichols@gmail.com>

- Prev by Date:
**Re: st: how to get marginal effect when dependent variable has ln function?** - Next by Date:
**Re: st: re: beta coefficients for interaction terms** - Previous by thread:
**Re: st: how to get marginal effect when dependent variable has ln function?** - Next by thread:
**Re: st: how to get marginal effect when dependent variable has ln function?** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |