library(IRon)
library(rpart)
if(requireNamespace("rpart")) {
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 <- rpart::rpart(form, train)
preds <- as.vector(predict(m,test))
trues <- test$acceleration
phi.trues <- phi(test$acceleration,ph)
ser(trues,preds,phi.trues)
}
Run the code above in your browser using DataLab