# Is there a way to find the specific number of predictors necessary for my caret random forests model?

I'm creating a random forest model (classification) in caret:

model <- train(formula,
data = training.data,
method = "rf")


I can get the variable importance list which ranks all the variables from most important to least:

varImp(model)


I can use that to report the top 20 predictors, but I'm interested in finding out at what point additional predictors don't significantly increase model fit. Twenty is somewhat arbitrary. Is there some statistical test to find out which predictors are necessary and a way to incorporate it into caret syntax?

• you might want to look into the fscaret package. – phiver Feb 9 '18 at 17:06