Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Thomas <tpt21@cam.ac.uk> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: margins at every observation |
Date | Wed, 13 Oct 2010 11:41:13 +0100 |
--- On Wed, 13/10/10, Thomas wrote:But it does not seem to allow negative values for the variable that is included in -over-. Is there any way around this?Yeah, but it all gets too complicated for my taste. I would just live with the fact that -margins- is not inteded to do what you want it to do, and instead do it manually. However, if you want to stick to the -margins- route, here is a solution: *--------- begin example -------- sysuse auto, clear // create negative values sum mpg , detail replace mpg = mpg - r(p50) // mpgid has a separate positive integers // value for each value of mpg egen mpgid = group(mpg), label reg price c.mpg##c.mpg margins, dydx(mpg) over(mpgid) // legend: label list mpgid *---------- end example ---------- Hope this helps, Maarten -------------------------- Maarten L. Buis Institut fuer Soziologie Universitaet Tuebingen Wilhelmstrasse 36 72074 Tuebingen Germany http://www.maartenbuis.nl -------------------------- * * 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/
Ok that is decided then. Thanks. * * 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/