1

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!

Tim K
  • 71
  • 7
  • 1
    That isn't a logistic regression that you fit. And the AUC shouldn't be 1 even if it was. I'm not familiar with the cstat you're talking about but if it should match with the auc it's definitely wrong here. – Dason Apr 24 '20 at 01:04
  • Sorry, I forgot to make specify the family as binomial, which I have now done (see edit). The output does not change, and I have the same problem where the C-statistic and AUC are not the same as I would have expected. – Tim K Apr 24 '20 at 03:09

1 Answers1

3

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.

Andri Signorell
  • 1,279
  • 12
  • 23