This help topic is for R version 0.90. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/predict.lm.html
predict.lm {base}R Documentation

Predicting from Linear Model Fits

Description

predict.lm produces predicted values, obtained by evaluating the regression function in the frame newdata. If the logical se.fit is TRUE, standard errors of the predictions are calculated. If the numeric argument scale is set (with optional 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 intervals specifies computation of confidence or prediction (tolerance) intervals at the specified level.

Usage

predict[.lm](object, newdata = model.frame(object), se.fit = FALSE,  
             scale = NULL, df = Inf, 
             interval = c("none", "confidence", "prediction"), level = 0.95)

Value

predict.lm produces a vector of predictions or a matrix of predictions and bounds with column names fit, lwr, and upr if interval is set. If se.fit is TRUE, a list with the following components is returned

fit

vector or matrix as above

se.fit

standard error of predictions

residual.scale

residual standard deviations

df

degrees of freedom for residual

See Also

The model fitting function lm, predict.

Examples

## Predictions
x <- rnorm(15)
y <- x + rnorm(15)
predict(lm(y ~ x))
predict(lm(y ~ x), data.frame(x = seq(-3, 3, 0.1)), se = TRUE)

[Package base version 0.90 ]