\HeaderA{predict.bSpline}{Evaluate a Spline at New Values of x}{predict.bSpline}
\aliasA{predict.nbSpline}{predict.bSpline}{predict.nbSpline}
\aliasA{predict.npolySpline}{predict.bSpline}{predict.npolySpline}
\aliasA{predict.pbSpline}{predict.bSpline}{predict.pbSpline}
\aliasA{predict.ppolySpline}{predict.bSpline}{predict.ppolySpline}
\keyword{models}{predict.bSpline}
\begin{Description}\relax
The \code{predict} methods for the classes that inherit from the
virtual classes \code{bSpline} and \code{polySpline} are used to
evaluate the spline or its derivatives.  The \code{plot} method for a
spline object first evaluates \code{predict} with the \code{x}
argument missing, then plots the resulting \code{xyVector} with
\code{type = "l"}.
\end{Description}
\begin{Usage}
\begin{verbatim}
## 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, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] An object that inherits from the \code{bSpline} or the
\code{polySpline} class.
\item[\code{x}] A numeric vector of \code{x} values at which to evaluate the
spline.  If this argument is missing a suitable set of \code{x}
values is generated as a sequence of \code{nseq} segments spanning
the range of the knots.
\item[\code{nseg}] A positive integer giving the number of segments in a set
of equally-spaced \code{x} values spanning the range of the knots
in \code{object}.  This value is only used if \code{x} is missing.
\item[\code{deriv}] An integer between 0 and \code{splineOrder(object) - 1}
specifying the derivative to evaluate.
\item[\code{...}] further arguments passed to or from other methods.
\end{ldescription}
\end{Arguments}
\begin{Value}
an \code{xyVector} with components
\begin{ldescription}
\item[\code{x}] the supplied or inferred numeric vector of \code{x} values
\item[\code{y}] the value of the spline (or its \code{deriv}'th derivative)
at the \code{x} vector
\end{ldescription}
\end{Value}
\begin{Author}\relax
Douglas Bates and Bill Venables
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{xyVector}{xyVector}},
\code{\LinkA{interpSpline}{interpSpline}},
\code{\LinkA{periodicSpline}{periodicSpline}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
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)
\end{ExampleCode}
\end{Examples}

