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]

From |
"Bischof, Daniel" <[email protected]> |

To |
"[email protected]" <[email protected]> |

Subject |
Re: st: marginal effects for polynomial regressions |

Date |
Wed, 15 Jan 2014 14:24:04 +0000 |

Hi Maarten, this appears to be working fine. Thank you very much. A short follow up: Once I calculate a cubic term instead of the polynomial one, I would start of like this (Thanks for the nice example, I permitted myself to use it as well): -----example start------- //sample data: sysuse nlsw88, clear //model: poisson wage c.ttl_exp##c.ttl_exp##c.ttl_exp collgrad grade union i.race, vce(robust) *But afterwards I would do exactly the same to obtain the margin means & marginal effects: //margin means: margins, at(collgrad=0 grade=12 race=1 union=1 ttl_exp=(1(1)28)) marginsplot //marginal effects: margins, at(collgrad=0 grade=12 race=1 union=1 ttl_exp=(1(1)28)) dydx(ttl_exp) marginsplot ---------example end-------- Am 15.01.2014 um 11:23 schrieb Maarten Buis <[email protected]>: > The last two commands give you the marginal means. It does help you > visuallize the effect,but it does not give you the derivatives. Below > is an example of how to use both: > > *------------------ begin example ------------------ > // load some example data > sysuse nlsw88, clear > > // estimate a model > poisson wage c.ttl_exp##c.ttl_exp collgrad grade union i.race, vce(robust) > > // compute marginal means > margins, at(collgrad=0 grade=12 race=1 union=1 ttl_exp=(1(1)28)) > marginsplot, name(means) > > // compute marginal effects > margins, at(collgrad=0 grade=12 race=1 union=1 ttl_exp=(1(1)28)) dydx(ttl_exp) > marginsplot, name(mfx) > *------------------- end example ------------------- > * (For more on examples I sent to the Statalist see: > * http://www.maartenbuis.nl/example_faq ) > > Hope this helps, > Maarten > > > On Wed, Jan 15, 2014 at 12:11 PM, Bischof, Daniel <[email protected]> wrote: >> Hi, >> >> I'm currently running a polynomial regression and I'm trying to calculate marginal effects using the margin command. Therefore my regression model is as follows: >> >> Y = a + b1*x1+ b2*x1^2 + controls (1) >> >> Putting this into a stata command turns out to be the following: >> >> reg c.x##c.x + controls (2) >> >> Then I calculated the margins by using the following: >> >> margins, over(x) at((means) controls) (3) >> >> And the marginsplot by using: >> >> marginsplot (4) >> >> Yet, I'm not sure the last two commands will do the deal (3+4), since I'm not sure whether stata is then calculating the derivate of function (1) or just for the very first part of the expression (b1x1). I hope somebody can help me out on this! >> >> Thank you very much in advance, >> >> Daniel >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/faqs/resources/statalist-faq/ >> * http://www.ats.ucla.edu/stat/stata/ > > > > -- > --------------------------------- > Maarten L. Buis > WZB > Reichpietschufer 50 > 10785 Berlin > Germany > > http://www.maartenbuis.nl > --------------------------------- > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**References**:**st: marginal effects for polynomial regressions***From:*"Bischof, Daniel" <[email protected]>

**Re: st: marginal effects for polynomial regressions***From:*Maarten Buis <[email protected]>

- Prev by Date:
**Ang: Re: Re: Re: st: Words surrounded with single quotes in a local macro** - Next by Date:
**st: Course: Practical use of Multiple Imputation to Handle Missing Data in Stata** - Previous by thread:
**Re: st: marginal effects for polynomial regressions** - Next by thread:
**st: Foreach and collapse** - Index(es):