--- On Thu, 11/2/10, Christian Weiss wrote:
> I am estimating a piecewise regression (dependent var: a,
> independent variables xyz) using mkspline.
>
> Do you have any hint what's the most convenient way
> plotting the results of the regression in a linechart (e.g.
> using a and x)?
*--------------------- begin example --------------------
sysuse auto, clear
mkspline mpg1 20 mpg2 = mpg
reg price mpg? foreign rep78
margins, at(foreign=0 rep78=3) over(mpg)
preserve
gen byte touse = e(sample)
bys touse mpg : keep if _n == 1 & touse
sort mpg
keep mpg
matrix b = r(b)'
svmat b
twoway line b mpg , ///
title(predicted price for US cars with average repair status)
restore
*--------------------- end example --------------------------
( For more on how to use examples I sent to statalist see:
http://www.maartenbuis.nl/stata/exampleFAQ.html )
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/