\Header{predict.nls}{Predicting from Nonlinear Least Squares Fits}
\keyword{nonlinear}{predict.nls}
\keyword{regression}{predict.nls}
\keyword{models}{predict.nls}
\begin{Description}\relax
\code{predict.nls} produces predicted values, obtained by evaluating
the regression function in the frame \code{newdata}.  If the logical
\code{se.fit} is \code{TRUE}, standard errors of the predictions are
calculated.  If the numeric argument \code{scale} is set (with
optional \code{df}), it is used as the residual standard deviation in
the computation of the standard errors, otherwise this is extracted
from the model fit.  Setting \code{intervals} specifies computation of
confidence or prediction (tolerance) intervals at the specified
\code{level}.

At present \code{se.fit} and \code{interval} are ignored.\end{Description}
\begin{Usage}
\begin{verbatim}
## S3 method for class 'nls':
predict(object, newdata , se.fit = FALSE, scale = NULL, df = Inf, 
        interval = c("none", "confidence", "prediction"),
        level = 0.95, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] An object that inherits from class \code{nls}.
\item[\code{newdata}] A named list or data frame with values of the input
variables for the model in \code{object}.  If \code{newdata} is
missing the fitted values at the original data points are returned.
\item[\code{se.fit}] A logical value indicating if the standard errors of the
predictions should be calculated.  Defaults to \code{FALSE}.  At
present this argument is ignored.
\item[\code{scale}] A numeric scalar.  If it is set (with optional
\code{df}), it is used as the residual standard deviation in the
computation of the standard errors, otherwise this information is
extracted from the model fit. At present this argument is ignored.
\item[\code{df}] A positive numeric scalar giving the number of degrees of
freedom for the \code{scale} estimate. At present this argument is
ignored.
\item[\code{interval}] A character string indicating if prediction intervals
or a confidence interval on the mean responses are to be
calculated. At present this argument is ignored.
\item[\code{level}] A numeric scalar between 0 and 1 giving the confidence
level for the intervals (if any) to be calculated.  At present
this argument is ignored.
\item[\code{...}] Additional optional arguments.  At present no optional
arguments are used.
\end{ldescription}
\end{Arguments}
\begin{Value}
\code{predict.nls} produces a vector of predictions.
When implemented, \code{interval} will produce a matrix of
predictions and bounds with column names \code{fit}, \code{lwr}, and
\code{upr}.  When implemented, if \code{se.fit} is
\code{TRUE}, a list with the following components will be returned:

\begin{ldescription}
\item[\code{fit}] vector or matrix as above
\item[\code{se.fit}] standard error of predictions
\item[\code{residual.scale}] residual standard deviations
\item[\code{df}] degrees of freedom for residual
\end{ldescription}
\end{Value}
\begin{SeeAlso}\relax
The model fitting function \code{\Link{nls}},
\code{\Link{predict}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data( BOD )
fm <- nls(demand ~ SSasympOrig(Time, A, lrc), data = BOD)
predict(fm)              # fitted values at observed times
## Form data plot and smooth line for the predictions
opar <- par(las = 1)
plot(demand ~ Time, data = BOD, col = 4,
     main = "BOD data and fitted first-order curve",
     xlim = c(0,7), ylim = c(0, 20) )
tt <- seq(0, 8, length = 101)
lines(tt, predict(fm, list(Time = tt)))
par(opar)
\end{ExampleCode}
\end{Examples}

