Hi,

I'm using package "caret" to rank predictors using random forest model and draw 
predictors importance plot. I used below commands:

rf.fit<-randomForest(x,y,ntree=500,importance=TRUE) 
## "x" is matrix whose columns are predictors, "y" is a binary resonse vector
## Then I got the ranked predictors by ranking 
"rf1$importance[,"MeanDecreaseAccuracy"]"
## Then draw the importance plot
varImpPlot(rf.fit)

As you can see, all the functions I used are directly from the package 
"randomForest", instead of from "caret". so I'm wondering if the package 
"caret" has some functions who can do the above ranking and ploting.

In fact, I tried functions "train", "varImp" and "plot" from package "caret", 
the random forest model that built by "train" can not be input correctly to 
"varImp", which gave error message like "subscripts out of bounds". Also 
function "plot" doesn't work neither.

So I'm wondering if anybody has encountered the same problem before, and could 
shed some light on this. I would really appreciate your help.

Thanks,
Xiaoqi

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to