Make Predictions from a Fitted Model Object

DESCRIPTION:
Returns a vector or array of predictions.

This function is generic (see Methods); method functions can be written to handle specific classes of data. Classes which already have methods for this function include: factanal, gam, glm, lm, loess, mlm, princomp, smooth.spline, tree.


USAGE:
predict(object, ...)

REQUIRED ARGUMENTS:
object:
a fitted model object.

VALUE:
a vector or array of predictions, or a list consisting of the predictions and their standard errors. A standard use of predict is to simply extract the fitted values from a fit object, or in the case of generalized models, to extract the linear or additive predictor.

WARNING:
predict on objects of class "lm" or "glm" can produce incorrect predictions when the newdata argument is used if the formula in object involves data-dependent transformations, such as poly(Age, 3) or sqrt(Age - min(Age)). The predict.gam method overcomes this for the gam, glm, and lm classes. In other cases, this can be overcome by explicitly supplying the derived matrix for predictions, rather than a data frame.

SEE ALSO:
expand.grid , fitted , predict.gam , predict.glm .

EXAMPLES:
# extract the fitted linear predictor from a glm object
glmob <- glm(Kyphosis ~ poly(Age, 2) + (Number > 5)*Start,
             family = binomial, data = kyphosis)
predict(glmob)

predict(gamob, newdata, type = "terms")