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"`

.

1 2 3 4 5 6 7 8 9 10 | ```
## S3 method for class 'bSpline'
predict(object, x, nseg = 50, deriv = 0, ...)
## S3 method for class 'nbSpline'
predict(object, x, nseg = 50, deriv = 0, ...)
## S3 method for class 'pbSpline'
predict(object, x, nseg = 50, deriv = 0, ...)
## S3 method for class 'npolySpline'
predict(object, x, nseg = 50, deriv = 0, ...)
## S3 method for class 'ppolySpline'
predict(object, x, nseg = 50, deriv = 0, ...)
``` |

`object` |
An object that inherits from the |

`x` |
A numeric vector of |

`nseg` |
A positive integer giving the number of segments in a set
of equally-spaced |

`deriv` |
An integer between 0 and |

`...` |
further arguments passed to or from other methods. |

an `xyVector`

with components

`x` |
the supplied or inferred numeric vector of |

`y` |
the value of the spline (or its |

Douglas Bates and Bill Venables

`xyVector`

,
`interpSpline`

,
`periodicSpline`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
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)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.