Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

From ?combine in randomForest:

The confusion, err.rate, mse and rsq components (as well as the corresponding components in the test compnent, if exist) of the combined object will be NULL.

Why are the err.rate, mse and rsq components for the combined NULL? Is there an efficient way to re-calculate these metrics?

I ask because I would like to figure out a way to use the oob re-sampling method with the parRF model in caret.

share|improve this question

2 Answers

up vote 3 down vote accepted

Because, at least in default setting, the split of objects into bags is lost.

To replicate, you have to train each partial model with keep.inbag=TRUE, then predict the training set with predict(model,trainSet,predict.all=TRUE) and clip it to out-of-bags using bag splits from model$inbag.
Now, you do this for all forests you want to merge, bind and use to calculate the metrics.

(I'll try to extend this to actual code later)

share|improve this answer
thanks for the explanation! – Zach Aug 9 '11 at 15:58
1  
Is it later yet? =) – Zach Feb 6 '12 at 21:08

According to this answer, the out-of-bag predictions for the combined object can be calculated as follows, as predict.randomForest returns out-of-bag predictions (if newdata is not given):

set.seed(42)
library(randomForest)
rf1 <-randomForest(Species ~ ., iris, ntree=50, norm.votes=FALSE) 
rf2 <- randomForest(Species ~ ., iris, ntree=50, norm.votes=FALSE) 
rf3 <- randomForest(Species ~ ., iris, ntree=50, norm.votes=FALSE) 

rf.all <- combine(rf1, rf2, rf3) 
predict(rf.all, type='prob')
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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