library(randomForest)
library(edarf)
fit <- randomForest(hp ~ ., mtcars)
pred <- predict(fit, newdata = mtcars)
plot_pred(pred, mtcars$hp,
outlier_idx = which(abs(pred - mtcars$hp) > .5 * sd(mtcars$hp)),
labs = row.names(mtcars))
Run the code above in your browser using DataLab