I found a couple of explanations what the out-of-bag error is, including one on stackoverflow: What is out of bag error in random forests
However I could not find any formulas how to calculate it exactly. Let's take the MATLAB help-files as an example: err = oobError(B) computes the misclassification probability[...]. B is the model of the trees generated with class TreeBagger.
What is the misclassification probability? Is it simply the accuracy of the out-of-bag data?
Accuracy = (TP + FP) / (P+N)
So simply the ratio of all truly classified instances over all instances present in the set?
If this is correct, I on the one hand see the benefit of calculating it, at is quite simple if you have some datasets to test on anyway, as the out-of-bag dataset are.
But on the other hand, accuracy is known to be not a good metric when it comes to imbalanced datasets. So my second question then is: Can the out-of-bag error cope with imbalanced datasets, and if not, is it even a valid point to specify it in such cases?