library(IRon)
if(requireNamespace("earth")) {
data(accel)
form <- acceleration ~ .
ind <- sample(1:nrow(accel),0.75*nrow(accel))
train <- accel[ind,]
test <- accel[-ind,]
ph <- phi.control(accel$acceleration)
m <- earth::earth(form, train)
preds <- as.vector(predict(m,test))
eval.stats(form, train, test, preds)
eval.stats(form, train, test, preds, ph)
eval.stats(form, train, test, preds, ph, cf=3) # Focusing on extreme outliers
}
Run the code above in your browser using DataLab