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

From |
Austin Nichols <austinnichols@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

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

Date |
Sun, 21 Jun 2009 11:11:14 -0400 |

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/

**Follow-Ups**:**AW: st: how to get marginal effect when dependent variable has ln function?***From:*"Martin Weiss" <martin.weiss1@gmx.de>

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

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

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