\HeaderA{predict}{Model Predictions}{predict}
\keyword{methods}{predict}
\begin{Description}\relax
\code{predict} is a generic function for predictions from the results of
various model fitting functions.  The function invokes particular
\emph{methods} which depend on the \code{\LinkA{class}{class}} of
the first argument.
\end{Description}
\begin{Usage}
\begin{verbatim}
predict (object, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] a model object for which prediction is desired.
\item[\code{...}] additional arguments affecting the predictions produced.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Most prediction methods which similar to fitting linear models have an
argument \code{newdata} specifiying the first place to look for
explanatory variables to be used for prediction.
Some considerable attempts are made to match up
the columns in \code{newdata} to those used for fitting, for example
that they are of comparable types and that any factors have the same
level set in the same order (or can be transformed to be so).

Time series prediction methods in package \pkg{stats} have an argument
\code{n.ahead} specifying how many time steps ahead to predict.

Many methods have a logical argument \code{se.fit} saying if standard
errors are to returned.
\end{Details}
\begin{Value}
The form of the value returned by \code{predict} depends on the
class of its argument.  See the documentation of the
particular methods for details of what is produced by that method.
\end{Value}
\begin{References}\relax
Chambers, J. M. and Hastie, T. J. (1992)
\emph{Statistical Models in S}.
Wadsworth \& Brooks/Cole.
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{predict.glm}{predict.glm}},
\code{\LinkA{predict.lm}{predict.lm}},
\code{\LinkA{predict.loess}{predict.loess}},
\code{\LinkA{predict.nls}{predict.nls}},
\code{\LinkA{predict.poly}{predict.poly}},
\code{\LinkA{predict.princomp}{predict.princomp}},
\code{\LinkA{predict.smooth.spline}{predict.smooth.spline}}.

For time-series prediction,
\code{\LinkA{predict.ar}{predict.ar}},
\code{\LinkA{predict.Arima}{predict.Arima}},
\code{\LinkA{predict.arima0}{predict.arima0}},
\code{\LinkA{predict.HoltWinters}{predict.HoltWinters}},
\code{\LinkA{predict.StructTS}{predict.StructTS}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
require(utils)

## All the "predict" methods found
## NB most of the methods in the standard packages are hidden.
for(fn in methods("predict"))
   try({
       f <- eval(substitute(getAnywhere(fn)$objs[[1]], list(fn = fn)))
       cat(fn, ":\n\t", deparse(args(f)), "\n")
       }, silent = TRUE)
\end{ExampleCode}
\end{Examples}

