Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

predict.lmRob

Use predict() on an lmRob Object


Description

Extracts the fitted values from an lmRob object and returns a matrix of predictions.

Usage

## S3 method for class 'lmRob'
predict(object, newdata, type = "response", se.fit = FALSE, terms = labels(object), ...)

Arguments

object

an lmRob object.

newdata

a data frame containing the values at which predictions are required. This argument can be missing, in which case predictions are made at the same values used to compute the object. Only those predictors referred to in the right side of the formula in object need be present by name in newdata.

type

a single character value specifying the type of prediction. The only choice is "response". If "response" is selected, the predictions are on the scale of the response.

se.fit

a logical value. If TRUE, pointwise standard errors are computed along with the predictions.

terms

this argument is presently unused.

...

additional arguments required by the generic predict function.

Value

a vector of predictions, or a list consisting of the predictions and their standard errors if se.fit = TRUE.

Warning

predict 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)).

See Also

Examples

data(stack.dat)
stack.rob <- lmRob(Loss ~ ., data = stack.dat)
predict(stack.rob)
predict(stack.rob, newdata = stack.dat[c(1,2,4,21), ], se.fit = TRUE)

robust

Port of the S+ "Robust Library"

v0.5-0.0
GPL-2
Authors
Jiahui Wang, Ruben Zamar <ruben@stat.ubc.ca>, Alfio Marazzi <Alfio.Marazzi@inst.hospvd.ch>, Victor Yohai <vyohai@dm.uba.ar>, Matias Salibian-Barrera <matias@stat.ubc.ca>, Ricardo Maronna <maron@mate.unlp.edu.ar>, Eric Zivot <ezivot@u.washington.edu>, David Rocke <dmrocke@ucdavis.edu>, Doug Martin, Martin Maechler <maechler@stat.math.ethz.ch>, Kjell Konis <kjell.konis@me.com>.
Initial release
2020-03-07

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.