Hi,
I am attempting to find the 95% CI of the c-statistic for ROC curves using bootstrapping. However, I keep getting the following error when I run this code:
FUN = function(Excluded_data, i){
fit = glm(LOS_quartiles ~ PH_Z + AGE_SURGERY + SEX + RACE + ETHNICITY + MARITAL_STATUS +INSURANCE, data = Excluded_data[i,], family = "binomial")
DescTools::Cstat(fit)
}
res = boot(Excluded_data, FUN, R=999)
boot.ci(boot.out = res, type = "perc")
Error: contrasts can be applied only to factors with 2 or more levels.
However, all of the factors and continuous variables (AGE_SURGERY and PH_Z) have more than 1 unique value and I have filtered out NA values. How can I resolve this issue?
Any suggestions would be much appreciated. Thanks in advance.