[R] Confidence Interval for Ipred Bagging outputs ?

David Winsemius dwinsemius at comcast.net
Sat Mar 19 19:15:16 CET 2016

> On Mar 19, 2016, at 12:36 AM, Majid Javanmard <micka.youngman at gmail.com> wrote:
> Hello everyone
> here is the code that implements bagging using ipred package in R :
> library(ipred)
> library(mlbench)
> data("BostonHousing")
> # Test set error (nbagg=25, trees pruned): 3.41 (Breiman, 1996a, Table 8)
> mod <- bagging(medv ~ ., data=BostonHousing, coob=TRUE)
> print(mod)
> pred <- predict(mod)
> pred<- as.data.frame(pred)
> How can I have 95% Confidence interval for each predicted values !?

Perhaps you really mean prediction intervals, since none of those results really a parameters. I don't think it makes sense to talk about 95%CI's in the context of a bagging procedure because there really is no single model. In any case it has already been suggested that this is not really an R coding problem but rather a conceptual problem. You were advised to post further questions on stats.stackexchange.com (if you were unable to find an answered question), the first hit on a Google search for "confidence Interval randomForest":



David Winsemius
Alameda, CA, USA

More information about the R-help mailing list