Rev 78278 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/stats/man/predict.Rd% Part of the R package, https://www.R-project.org% Copyright 1995-2020 R Core Team% Distributed under GPL 2 or later\name{predict}\title{Model Predictions}\usage{predict (object, \dots)}\alias{predict}\arguments{\item{object}{a model object for which prediction is desired.}\item{\dots}{additional arguments affecting the predictions produced.}}\description{\code{predict} is a generic function for predictions from the results ofvarious model fitting functions. The function invokes particular\emph{methods} which depend on the \code{\link{class}} ofthe first argument.}\details{Most prediction methods which are similar to those for linear modelshave an argument \code{newdata} specifying the first place to look forexplanatory variables to be used for prediction. Some considerableattempts are made to match up the columns in \code{newdata} to thoseused for fitting, for example that they are of comparable types andthat any factors have the same level set in the same order (or can betransformed 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 standarderrors are to returned.}\value{The form of the value returned by \code{predict} depends on theclass of its argument. See the documentation of theparticular methods for details of what is produced by that method.}\seealso{\code{\link{predict.glm}},\code{\link{predict.lm}},\code{\link{predict.loess}},\code{\link{predict.nls}},\code{\link{predict.poly}},\code{\link{predict.princomp}},\code{\link{predict.smooth.spline}}.\link{SafePrediction} for prediction from (univariable) polynomial andspline fits.For time-series prediction,\code{\link{predict.ar}},\code{\link{predict.Arima}},\code{\link{predict.arima0}},\code{\link{predict.HoltWinters}},\code{\link{predict.StructTS}}.}\references{Chambers, J. M. and Hastie, T. J. (1992)\emph{Statistical Models in S}.Wadsworth & Brooks/Cole.}\examples{\dontshow{old <- Sys.getlocale("LC_COLLATE")invisible(Sys.setlocale("LC_COLLATE", "C"))}require(utils)## All the "predict" methods found## NB most of the methods in the standard packages are hidden.## Output will depend on what namespaces are (or have been) loaded.## IGNORE_RDIFF_BEGINfor(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)## IGNORE_RDIFF_END\dontshow{invisible(Sys.setlocale("LC_COLLATE", old))}}\keyword{methods}