13
$\begingroup$

In regression problems random forests yield a prediction for each case by averaging the results of each single tree in the forest. I would like to draw a 95% prediction interval around each prediction. There is a nice option interval="prediction" for the prediction method of linear models, but there's no such thing for random forests (at least in the R package randomForest). Can I presume that the casewise predictions of the single trees are normally distributed and apply the formula http://mathurl.com/bbvuvx9 or should I determine it by bootstrapping? If so, how can this be done?

$\endgroup$

2 Answers 2

8
$\begingroup$

I'm assuming you're talking about the continuous response case. If so, I'd recommend the quantregForest package that layers on top of the basic randomForest package and gives conditional quantile predictions. The documentation is quite good. Instead of assuming a gaussian distribution, it build an empirical density function from the terminal nodes.

$\endgroup$
3
  • 2
    $\begingroup$ stats.ox.ac.uk/~meinshau/quantregforests.pdf describes the technique. $\endgroup$
    – B_Miner
    Commented Feb 11, 2013 at 17:30
  • 1
    $\begingroup$ @Shea Parkes: I did not know this package, thanks for the hint. $\endgroup$
    – user7417
    Commented Feb 12, 2013 at 10:00
  • $\begingroup$ @B_Miner: I already downloaded the pdf and shall dig into it... Certainly I'll come back with more questions ;-) $\endgroup$
    – user7417
    Commented Feb 12, 2013 at 10:00
1
$\begingroup$

The ranger package supports quantile predictions and hence prediction intervals: predict(ranger_fit, type = "quantile", quantiles = c(0.025, 0.975)).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.