I would like to get predictions and associated standard errors using the ranger method, but from caret::rfe() function. For example, if I were to do this without using rfe, I could get predictions and standard errors as follows,
data("iris")
glimpse(iris)
ranger.train<-ranger(Sepal.Length~.,iris,num.trees=10,keep.inbag =TRUE)
predict(ranger.train,iris,type='se')
predict(ranger.train,iris,type='se')$predictions
predict(ranger.train,iris,type='se')$se
But if predicting using the rfe output I can only obtain predictions, not standard errors. I think the issue is that I need to specify "keep.inbag=TRUE" somehow in the rfe algorithm. As a working example,
rcontrol <- rfeControl(functions=rfFuncs, method="cv", number=10)
set.seed(4484)
rfe.train <- rfe(iris[,2:5], iris[[1]], sizes=c(1,2), rfeControl=rcontrol,method = "ranger")
predict(rfe.train,iris,type='se')#predictions
predict(rfe.train,iris,type='se')$se# $ operator is invalid for atomic vectors
predict(rfe.train,iris,type='response')#predictions