\HeaderA{predict.loess}{Predict Loess Curve or Surface}{predict.loess}
\keyword{smooth}{predict.loess}
\begin{Description}\relax
Predictions from a \code{loess} fit, optionally with standard errors.
\end{Description}
\begin{Usage}
\begin{verbatim}
## S3 method for class 'loess':
predict(object, newdata = NULL, se = FALSE, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] an object fitted by \code{loess}.
\item[\code{newdata}] an optional data frame in which to look for variables with
which to predict.  If missing, the original data points are used.
\item[\code{se}] should standard errors be computed?
\item[\code{...}] arguments passed to or from other methods.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The standard errors calculation is slower than prediction.

When the fit was made using \code{surface="interpolate"} (the
default), \code{predict.loess} will not extrapolate -- so points outside
an axis-aligned hypercube enclosing the original data will have
missing (\code{NA}) predictions and standard errors.
\end{Details}
\begin{Value}
If \code{se = FALSE}, a vector giving the prediction for each row of
\code{newdata} (or the original data). If \code{se = TRUE}, a list
containing components
\begin{ldescription}
\item[\code{fit}] the predicted values.
\item[\code{se}] an estimated standard error for each predicted value.
\item[\code{residual.scale}] the estimated scale of the residuals used in
computing the standard errors.
\item[\code{df}] an estimate of the effective degrees of freedom used in
estimating the residual scale, intended for use with t-based
confidence intervals. 
\end{ldescription}

If \code{newdata} was the result of a call to
\code{\LinkA{expand.grid}{expand.grid}}, the predictions (and s.e.'s if requested)
will be an array of the appropriate dimensions.
\end{Value}
\begin{Note}\relax
Variables are first looked for in \code{newdata} and then searched for
in the usual way (which will include the environment of the formula
used in the fit).  As from \R{} 2.0.0 a warning will be given if the
variables found are not of the same length as those in \code{newdata}
if it was supplied.
\end{Note}
\begin{Author}\relax
B.D. Ripley, based on the \code{cloess} package of Cleveland,
Grosse and Shyu.
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{loess}{loess}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
cars.lo <- loess(dist ~ speed, cars)
predict(cars.lo, data.frame(speed=seq(5, 30, 1)), se=TRUE)
# to get extrapolation
cars.lo2 <- loess(dist ~ speed, cars,
  control=loess.control(surface="direct"))
predict(cars.lo2, data.frame(speed=seq(5, 30, 1)), se=TRUE)
\end{ExampleCode}
\end{Examples}

