Thanks for the reference! Sorry, I should rephrase my words. I was talking about the "else 0" part. The formula says if nPos == nObs then the ROC AUC is 0. This is apparently wrong because any model becomes the "best" model in such case, while a good model should never have ROC AUC below 0.5. This is why I asked for the origin of the formula.