Statalist


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

st: Display spline knots with xline?


From   Claus Dethlefsen <[email protected]>
To   [email protected]
Subject   st: Display spline knots with xline?
Date   Wed, 28 Jan 2009 12:13:57 +0100

Dear list

Using cubic splines, I would like to display the knots used. In Stata
10, I can use mkspline to create the spline variables and it returns
the values of the knots in a matrix. I would like to transfer this
matrix in a nice way to my scatter plot command as the xline argument.
Example:


sysuse auto
mkspline smpg=mpg, nknots(7) displayknots cubic
matrix list r(knots)


scatter price mpg, xline(14         16         18         20
23         26         31)
                                   ^ here I would like to write
r(knots) instead of copy-pasting the values

Best regards,
Claus
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index