title: tuneRF vs caret tunning for random forest
body: <p>I've trying to tune a random forest model using the tuneRF tool included in the randomForest Package and I'm also using the caret package to tune my model. The issue is that I'm tunning to get mtry and I'm getting different results for each approach. The question is how do I know which is the best approach and base on what? I'm not clear if I should expect similar or different results.</p>
  
  <p>tuneRF: with this approach I'm getting the best mtry is 3</p>
  
  <pre><code>t &lt;- tuneRF(train[,-12], train[,12],
          stepFactor = 0.5,
          plot = TRUE,
          ntreeTry = 100,
          trace = TRUE,
          improve = 0.05)
  </code></pre>
  
  <p>caret: With this approach I'm always getting that the best mtry is all variables in this case 6</p>
  
  <pre><code>control &lt;- trainControl(method="cv", number=5)
  tunegrid &lt;- expand.grid(.mtry=c(2:6))
  set.seed(2)
  custom &lt;- train(CRTOT_03~., data=train, method="rf", metric="rmse", 
                  tuneGrid=tunegrid, ntree = 100, trControl=control)
  </code></pre>