interpSpline {splines} | R Documentation |
Create an interpolation spline, either from x
and y
vectors, or from a formula/data.frame combination.
interpSpline(obj1, obj2, bSpline = FALSE, period = NULL,
na.action = na.fail)
obj1 |
Either a numeric vector of |
obj2 |
If |
bSpline |
If |
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 |
An object that inherits from class spline
. The object can be in
the B-spline representation, in which case it will be of class
nbSpline
for natural B-spline, or in the piecewise polynomial
representation, in which case it will be of class npolySpline
.
Douglas Bates and Bill Venables
splineKnots
,
splineOrder
,
periodicSpline
.
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 )