predict.bSpline
Evaluate a Spline at New Values of x
The predict
methods for the classes that inherit from the
virtual classes bSpline
and polySpline
are used to
evaluate the spline or its derivatives. The plot
method for a
spline object first evaluates predict
with the x
argument missing, then plots the resulting xyVector
with
type = "l"
.
 Keywords
 models
Usage
"predict"(object, x, nseg = 50, deriv = 0, ...)
"predict"(object, x, nseg = 50, deriv = 0, ...)
"predict"(object, x, nseg = 50, deriv = 0, ...)
"predict"(object, x, nseg = 50, deriv = 0, ...)
"predict"(object, x, nseg = 50, deriv = 0, ...)
Arguments
 object
 An object that inherits from the
bSpline
or thepolySpline
class.  x
 A numeric vector of
x
values at which to evaluate the spline. If this argument is missing a suitable set ofx
values is generated as a sequence ofnseq
segments spanning the range of the knots.  nseg
 A positive integer giving the number of segments in a set
of equallyspaced
x
values spanning the range of the knots inobject
. This value is only used ifx
is missing.  deriv
 An integer between 0 and
splineOrder(object)  1
specifying the derivative to evaluate.  ...
 further arguments passed to or from other methods.
Value

an
 x
 the supplied or inferred numeric vector of
x
values  y
 the value of the spline (or its
deriv
'th derivative) at thex
vector
xyVector
with components
See Also
Examples
library(splines)
require(graphics); require(stats)
ispl < interpSpline( weight ~ height, women )
opar < par(mfrow = c(2, 2), las = 1)
plot(predict(ispl, nseg = 201), # plots over the range of the knots
main = "Original data with interpolating spline", type = "l",
xlab = "height", ylab = "weight")
points(women$height, women$weight, col = 4)
plot(predict(ispl, nseg = 201, deriv = 1),
main = "First derivative of interpolating spline", type = "l",
xlab = "height", ylab = "weight")
plot(predict(ispl, nseg = 201, deriv = 2),
main = "Second derivative of interpolating spline", type = "l",
xlab = "height", ylab = "weight")
plot(predict(ispl, nseg = 401, deriv = 3),
main = "Third derivative of interpolating spline", type = "l",
xlab = "height", ylab = "weight")
par(opar)
Community examples
Looks like there are no examples yet.