[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: count regression with product & power terms |

Date |
Tue, 3 Feb 2009 15:42:11 -0500 |

Jason Franken <jrfranke@illinois.edu>: There are not marginal effects for both x1 and x1squared; there is only a marginal effect for x1, since you cannot vary x1 without also varying x1squared. I think you want something like this: sysuse nlsw88, clear g g2=grade^2 unab x: tenure hours south smsa poisson wage grade g2 `x', r predict double hat g double mf=hat*(_b[grade]+2*_b[g2]*grade) egen double amfx=mean(mf), by(grade) la var amfx "Mean Marginal Effect" bys grade: replace amfx=. if _n>1 drop hat mf foreach v of local x { ren `v' was`v' su was`v' if e(sample), meanonly g double `v'=r(mean) } predict double hat foreach v of local x { drop `v' ren was`v' `v' } g double mfxa=hat*(_b[grade]+2*_b[g2]*grade) bys grade (amfx): replace mfxa=. if _n>1 drop hat la var mfxa "Marginal Effect at Mean" line mfxa amfx grade On Tue, Feb 3, 2009 at 1:54 PM, <jrfranke@illinois.edu> wrote: > I'm running a count regression with x1 and x1^2 terms using the "poisson" command (I expect a nonlinear effect of x1), and want to compute marginal effects. > ... > *FOLLOWING SHOULD GIVE TRUE MARGINAL EFFECT FOR "x1" ... > *for the average of marginal effects for all observations (like "margeff"): > gen mf_x1 = (_b[x1]+(2*_b[x1squared]*x1))*eBX > sum mf_x1 > *for the marginal effect at mean values of other explanatory variables (like "mfx"): > gen mf_rpMEAN = (_b[x1]+(2*_b[x1squared]*x1bar))*eBXbar > list mf_rpMEAN > > *FOLLOWING SHOULD GIVE TRUE MARGINAL EFFECT FOR "x1squared". > *for the average of marginal effects for all observations (like "margeff"): > gen mf_x1squared = (2*_b[x1squared]*eBX) + (((_b[x1]+(2*_b[x1squared]*x1))^2)*eBX) > sum mf_x1squared > *for the marginal effect at mean values of other explanatory variables (like "mfx"): > gen mf_x1squaredMEAN = (2*_b[x1squared]*eBXbar) + (((_b[x1]+(2*_b[x1squared]*x1bar))^2)*eBXbar) > list mf_x1squaredMEAN * * 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: count regression with product & power terms***From:*<jrfranke@illinois.edu>

- Prev by Date:
**RE: st: Individual IDs with non-numeric characters** - Next by Date:
**st: Possible bug with Mata binomialp and variable argument** - Previous by thread:
**st: count regression with product & power terms** - Next by thread:
**st: Using Value Labels to Label Variables** - Index(es):

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