title: Consistency between OOB error rate and the confusion matrix
body: <p>When inspecting the statistics of my models, it looks like the numbers in the <code>confusion matrix</code> are not consistent with those of the <code>OOB error rate</code> in <code>randomForest</code>.  </p>
  
  <p><strong>How can I deduce the OOB error rate from the confusion matrix?</strong> What is the relationship between them?</p>
  
  <p>In the example below, I print the output from two models, one that was fit with stratified sampling (using a subset of the samples in <code>sampsize</code>) and one that was fit without (i.e. using the default sampling scheme, which I think uses all samples).  </p>
  
  <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <img src="https://i.stack.imgur.com/JUH4C.png" alt="enter image description here"></p>
  
  <p>I don't have the data public, but here are the function calls:</p>
  
  <pre><code>sumY = summary(Y)
  sampsize &lt;- c(sumY["Y0"]/10, sumY["Y1"])
  
  # First model in the image above
  strat.rf.model &lt;- randomForest(x=X,y=Y,sampsize=sampsize, strata=Y)
  
  # Second model in the image above    
  rf.model &lt;- randomForest(x=X,y=Y)
  </code></pre>