RandomForest in R: Is it possible to calculate casewise confidence intervals?

R random rank messages contains average errors for each tree in the forest. However, I need confidence in every case. in the data. Since randomForest calculates the case predictions by averaging the predictions of single trees, I think that it should also be possible to calculate the standard casewise error and therefore the confidence interval. Can this be done using the output object randomForest (if so: how?) Or do I need to paste the source code?

+4
source share
1 answer

No need to delve into the source code. You only need to read the documentation. ?predict.randomForest indicates that one of its arguments is called predict.all :

pred.all Should the predictions of all trees be kept?

Thus, setting for TRUE will contain a prediction for each case for each tree, which you can then use to calculate the standard error for each case.

I recently became aware of this article by Stefan Wager, Trevor Hasti, and Brad Efron, who more rigorously explore the idea of ​​standard prediction errors created by random forests (and other bag predictors).

+6
source

All Articles