interpSpline
Create an Interpolation Spline
Create an interpolation spline, either from x
and y
vectors, or from a formula/data.frame combination.
 Keywords
 models
Usage
interpSpline(obj1, obj2, bSpline = FALSE, period = NULL, na.action = na.fail)
Arguments
 obj1
 Either a numeric vector of
x
values or a formula.  obj2
 If
obj1
is numeric this should be a numeric vector of the same length. Ifobj1
is a formula this can be an optional data frame in which to evaluate the names in the formula.  bSpline
 If
TRUE
the bspline representation is returned, otherwise the piecewise polynomial representation is returned. Defaults toFALSE
.  period
 An optional positive numeric value giving a period for a periodic interpolation spline.
 na.action
 a optional function which indicates what should happen
when the data contain
NA
s. The default action (na.omit
) is to omit any incomplete observations. The alternative actionna.fail
causesinterpSpline
to print an error message and terminate if there are any incomplete observations.
Value

An object that inherits from class
spline
. The object can be in
the Bspline representation, in which case it will be of class
nbSpline
for natural Bspline, or in the piecewise polynomial
representation, in which case it will be of class npolySpline
.
See Also
Examples
library(splines)
require(graphics); require(stats)
ispl < interpSpline( women$height, women$weight )
ispl2 < interpSpline( weight ~ height, women )
# ispl and ispl2 should be the same
plot( predict( ispl, seq( 55, 75, length.out = 51 ) ), type = "l" )
points( women$height, women$weight )
plot( ispl ) # plots over the range of the knots
points( women$height, women$weight )
splineKnots( ispl )
Community examples
Looks like there are no examples yet.