predict.crm {crmReg}R Documentation

Predict method for CRM fits

Description

Obtains predictions from a fitted crm object.

Usage

## S3 method for class 'crm'
predict(object, newdata = NULL, ...)

Arguments

object

a fitted object of class "crm".

newdata

optionally, a data frame in which to look for variables with which to predict. If omitted, the fitted coefficients are used.

...

further arguments passed to or from other methods.

Details

predict.crm produces predicted values, obtained by evaluating the fitted crm object on the data frame newdata.

Value

predict.crm returns a vector of predicted response values.

Author(s)

Peter Filzmoser, Sebastiaan Hoppner, Irene Ortner, Sven Serneels, and Tim Verdonck

References

Filzmoser, P., Hoppner, S., Ortner, I., Serneels, S., and Verdonck, T. (2020). Cellwise Robust M regression. Computational Statistics and Data Analysis, 147, 106944. DOI:10.1016/j.csda.2020.106944

See Also

crm, spadimo, cellwiseheatmap, daprpr

Examples

library(crmReg)
data(topgear)

train <- topgear[1:200, ]
test <- topgear[201:245, ]

crmfit <- crm(formula = MPG ~ ., data = train, seed = 2020)

estimated_MPG_test <- predict(crmfit, newdata = test)

plot(test$MPG, estimated_MPG_test, xlab = "True MPG", ylab = "Estimated MPG")
abline(a = 0, b = 1)

[Package crmReg version 1.0.2 Index]