Learn R Programming

crmReg (version 1.0.2)

predict.crm: Predict method for CRM fits

Description

Obtains predictions from a fitted crm object.

Usage

# S3 method for 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.

Value

predict.crm returns a vector of predicted response values.

Details

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

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

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab