Statalist


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

Re: st: how do I get the knot values and show them (as xlab?) in the graph, using rcspline?


From   "jmpsouza" <[email protected]>
To   <[email protected]>
Subject   Re: st: how do I get the knot values and show them (as xlab?) in the graph, using rcspline?
Date   Mon, 4 May 2009 14:46:10 -0300

Dear Nick:
thank you very much for your kindness. It will be wonderful if you find the way to get just in one command both the position (-showknots-) and the values (-display- as in -mkspline...,dis-).
I used your orientation with some tweaks:

sysuse auto, clear
mkspline weight_ = weight,cubic nk(3) dis
rcspline mpg weight, showknots xlab( [values for x axis in general ] [values of knots from display])

Best regards,
José Maria

Jose Maria Pacheco de Souza, Professor Titular (aposentado)
Departamento de Epidemiologia/Faculdade de Saude Publica, USP
Av. Dr. Arnaldo, 715
01246-904  -  S. Paulo/SP - Brasil
fones (11)3061-7747; (11)3768-8612
fax (11)3714-2403
www.fsp.usp.br/~jmpsouza
----- Original Message ----- From: "Nick Cox" <[email protected]>
To: <[email protected]>
Sent: Monday, May 04, 2009 12:15 PM
Subject: RE: st: how do I get the knot values and show them (as xlab?) in the graph, using rcspline?


-rcspline- is on SSC.

Maarten is right, but his suggestion does not answer all of José Maria's question. A user might reasonably want to see the numerical values.

-rcspline- is not r-class, but the r-class results left behind by -mkspline, cubic- which -rcspline- calls are zapped by other programs -rcspline- calls, and so they are not visible to the user after it has finished.

I'll think about adding something to do this to the program: there are various possibilities. But running -mkspline, cubic- with equivalent options will leave the values in r(knots).

sysuse auto, clear
rcspline mpg weight, showknots
mkspline weight_ = weight, cubic

. mat li r(knots)

r(knots)[1,5]
         knot1    knot2    knot3    knot4    knot5
weight     1930  2336.25     3190  3518.75     4130

Nick
[email protected]


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