[R] How to generate natural cubic spline in R?

Frank E Harrell Jr f.harrell at vanderbilt.edu
Tue Mar 31 23:20:15 CEST 2009


David Winsemius wrote:
> The splinefun documentation indicates that "natural" is one of the types 
> of cubic spline options available.
> 
> Does rcs actually do fitting? Such would not be my expectation on 
> reading the documentation and I do not see any examples of such 
> functionality in the help pages.

It expands a predictor into the truncated power basis functions for the 
natural cubic spline.  This is an easier basis to use than the B-spline 
basis.  rcs calls the Hmisc function rcspline.eval which you may want to 
look at first.

Frank

-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University




More information about the R-help mailing list