[R] How to generate natural cubic spline in R?
David Winsemius
dwinsemius at comcast.net
Tue Mar 31 22:09:22 CEST 2009
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.
--
David Winsemius
On Mar 31, 2009, at 6:09 AM, Stephan Kolassa wrote:
> Hi,
>
> if you are looking for *natural* cubic splines (linear beyond the
> outer knots), you could use rcs() in Frank Harrell's Design package.
>
> HTH,
> Stephan
>
>
> David Winsemius schrieb:
>> If one enters:
>> ??"spline"
>> ... You get quite a few matches. The one in the stats functions
>> that probably answers your specific questions is:
>> "splinefun {stats} R Documentation
>> Interpolating Splines Description
>> Perform cubic (or Hermite) spline interpolation of given data
>> points, returning either a list of points obtained by the
>> interpolation or a function performing the interpolation."
>> "splinefun returns a function with formal arguments x and deriv,
>> the latter defaulting to zero. This function can be used to
>> evaluate the interpolating cubic spline (deriv=0), or its
>> derivatives (deriv=1,2,3) at the points x, where the spline
>> function interpolates the data points originally specified. This is
>> often more useful than spline."
>> Perhaps you need to review from you basic intro material regarding
>> help.search("text") # or
>> ??"text" # possibilities.
>
>
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list