Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: margins at every observation


From   Thomas <tpt21@cam.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: margins at every observation
Date   Tue, 12 Oct 2010 14:49:08 +0100

I want to calculate the marginal effects for all observations:

sysuse auto, clear
reg price c.mpg##c.mpg

gen dydx = _b[mpg]+2*_b[ c.mpg#c.mpg]*mpg

I thought I would get the same using:

margins, dydx(mpg) at((asobserved) mpg)

but I only get a single value at the mean of mpg.

How can I get the marginal effect at each observation from -margins- (if at all)?

Thanks,

Thomas
*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index