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   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
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 16:15:29 +0100

-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 
n.j.cox@durham.ac.uk 

Maarten buis

You can specify the -showknots- option. Quoting from the 
helpfile of -rcspline:
"-showknots- specifies that the positions of the knots be 
shown on the graph by vertical lines."

--- On Mon, 4/5/09, jmpsouza wrote:

> I am not able to get explicitly the knot values and to put
> them in the x axis when using rcspline (a .ado written by 
> Nick Cox). For example -rcspline rihoma nd3peso, stub(stub)
> gen(new) sh- gives a nice graph, but does not allow me   
> to know and to plot the knots.


*
*   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   |   What's new   |   Site index