loess
fit, optionally with standard errors.
"predict"(object, newdata = NULL, se = FALSE, na.action = na.pass, ...)
loess
.newdata
. The default is to predict NA
.se = FALSE
, a vector giving the prediction for each row of
newdata
(or the original data). If se = TRUE
, a list
containing components
newdata
was the result of a call to
expand.grid
, the predictions (and s.e.'s if requested)
will be an array of the appropriate dimensions.Predictions from infinite inputs will be NA
since loess
does not support extrapolation.
When the fit was made using surface = "interpolate"
(the
default), predict.loess
will not extrapolate -- so points outside
an axis-aligned hypercube enclosing the original data will have
missing (NA
) predictions and standard errors.
loess
cars.lo <- loess(dist ~ speed, cars)
predict(cars.lo, data.frame(speed = seq(5, 30, 1)), se = TRUE)
# to get extrapolation
cars.lo2 <- loess(dist ~ speed, cars,
control = loess.control(surface = "direct"))
predict(cars.lo2, data.frame(speed = seq(5, 30, 1)), se = TRUE)
Run the code above in your browser using DataLab