Calculate bootstrapped confidence intervals for c-statistics in a logistic regression using DescTools::Cstat A reviewer requested that we provide uncertainty measure of our c-statistics, and I guess 95% confidence interval is a good answer. I checked the manual of DescTools::Cstat(), and it says:

Confidence intervals for this measure can be calculated by bootstrap.

However, I can't find any example of calculating bootstrapped CI for c-statistics online. Can anybody provide an example of doing that in R. Here is a replicable example of conducting logistic regression in R:
d = mtcars
d$y = ifelse(mtcars$mpg >= 20, 1, 0)
fit = glm(y ~ gear + carb, data = d, family = "binomial")
DescTools::Cstat(fit)
# [1] 0.9430894

Thank you!
 A: You can use the package boot. You need to create a function that takes in a dataset, subset it according to the index, and then calculates an output.
For you situation, I created a function call func
func = function(Data,ind){
  fit = glm(y ~ gear + carb, data = Data[ind,], family = "binomial")
  DescTools::Cstat(fit)
}

The first argument is Data, which is your input data frame. The 2nd is the indices from which the boot function will sample for you. You can see inside the glm function, I subset Data based on ind.
So now the bootstrap:
library(boot)
res = boot(d,func,R=999)

Some of them will throw errors because it did not converge.. I hope for yours it doesn't. You can look at the ci using boot.ci, here i chose percentile, but there are other methods:
boot.ci(res,type="perc")
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 999 bootstrap replicates

CALL : 
boot.ci(boot.out = res, type = "perc")

Intervals : 
Level     Percentile     
95%   ( 0.8852,  1.0000 )  
Calculations and Intervals on Original Scale

