Skip to content

natural cubic splines

3 messages · Ondřej Mikula, Joshua Wiley, David Winsemius

#
Dear R-helpers,
I need to fit natural cubic spline with specified number of knots. I
expected 'splines' package will be helpful, but I am confused by its
help. Is more detailed documentation available for it or could you
recommend another R function?
Best regards
Ondrej Mikula
#
Hi Ondrej,

What documentation have you looked at?  Does this help at all?

require(splines)
?ns
## one example
summary(lm(y ~ ns(x, df = 3),
  data = data.frame(y = runif(100), x = rbinom(100, 9, .25)^2)))

## built in examples
example(ns)

Also, I am very fond of the book, Modern Applied Statistics with S by
Venables & Ripley.  It has a section on splines that might help you.

Cheers,

Josh


2011/5/4 Ond?ej Mikula <onmikula at gmail.com>:

  
    
#
On May 4, 2011, at 8:34 AM, Joshua Wiley wrote:

            
Agree on that last point entirely. I understand that restricted cubic  
splines are another name for natural splines (but would welcome  
correction if that understanding is in error). They are used  
extensively in the rms/Hmisc package combination with the supporting  
text "Regression Modeling Strategies".