1
$\begingroup$

When I run random forest in R package and use plot function, there have many curves including out of bag error rate curve (black colour) and the misclassification error rate curves (other colours). However, I only would like to show on the plot only the out of bag error rate curve. How can I do that?

enter image description here

$\endgroup$

2 Answers 2

0
$\begingroup$

The curves can be subsetted using the $ symbol in R.

So, this is how you single out the error rate curve.

$err.rate

You might also want to look at the documentation of the random forest plot by: (?plot.randomForest)

$\endgroup$
1
  • $\begingroup$ How would you plot the err.rate then? plot(someModel$err.rate) does not do the trick $\endgroup$
    – four-eyes
    Commented Sep 5, 2016 at 12:48
0
$\begingroup$

More in detail:

Your confusion Matrix contains a variable, called err.rate which you access with the $ sign. The err.rate is stored as a matrix where the first column is the OOB Error. Each class gets its own column. Try str(someModel$err.rate).

To access the err.rate do this $err.rate[,1], for plotting simply plot(myModel $err.rate[,1]). The other columns in your matrix are the error rates of your classes!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.