Search code examples
rlogistic-regressiondesctools

C statistic and AUC disagree


I have been finding that when I calculate the C-statistic with the inbuilt function from DescTools I am getting a different value from when I calculate the area under the receiver operating characteristic curve (AUC). For logistic regression, it should be the same. For instance, consider

> resp <- c(1,1,0,0)
> pred <- c(1,1,1,0)
> model <- glm(resp~pred, family = binomial())
> Cstat(model)
[1] 1
> roc(resp~pred)$auc
Area under the curve: 0.75

Would anyone please be able to explain why my calculated C-statistic and AUC are different and which measure I should be using for my C-statistic. Thanks!


Solution

  • Thanks for spotting that. This is a bug in Cstat(), where ties have not been properly treated. This will be fixed with DescTools version 0.99.35.