| predict | R Documentation |
Predicted values based on linear model object.
predict(
object,
newdata,
se.fit = FALSE,
scale = NULL,
df = Inf,
interval = c("none", "confidence", "prediction"),
level = 0.95,
type = c("response", "terms"),
terms = NULL,
na.action = na.pass,
pred.var = res.var/weights,
weights = 1,
...
)
object |
Object of class inheriting from "lm" |
newdata |
An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used. |
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. For type = "terms" this is a matrix with a column per term and may have an attribute "constant".
## Predictions x <- rnorm(15) y <- x + rnorm(15) predict(lm(y ~ x)) new <- data.frame(x = seq(-3, 3, 0.5)) predict(lm(y ~ x), new, se.fit = TRUE) pred.w.plim <- predict(lm(y ~ x), new, interval = "prediction") pred.w.clim <- predict(lm(y ~ x), new, interval = "confidence")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.