0

Please see if everything is correct with this code for calculating confidence intervals for the CAP Сurve.

`alpha <- 0.9
B <- 2000


boot_samples <- t(replicate(B, sample(p_hat, length(p_hat), replace = TRUE))) 
boot_means <- apply(boot_samples, 2, mean)  
z <- qnorm((1 + alpha) / 2)
jack_samples <- t(replicate(length(p_hat), sample(p_hat, length(p_hat)-1, replace = TRUE)))
jack_means <- apply(jack_samples, 2, mean)
jack_mean <- mean(p_hat)
jack_sd <- sqrt(((length(p_hat) - 1) / length(p_hat)) * sum((jack_means - jack_mean) ^ 2)) 
bias_corr <- mean(boot_means < jack_mean)  #bias bestimmen 
adj_factor <- qnorm(mean(boot_means < jack_mean) + alpha / 2)
intervals <- matrix(0, ncol = 2, nrow = length(p_hat))
for (i in 1:length(p_hat)) {
  intervals[i, ] <- c(p_hat[i] - adj_factor * jack_sd,
                  p_hat[i] + adj_factor * jack_sd)
}

results<-data.frame(intervals,p_hat)`

My problem is that if I calculate the AUC from the then obtained points at the confidence intervals using the bootstrap method, then the total sum of the coefficients for the lower and upper bounds will not be equal to the confidence intervals for AUC built using the McNeil formula

Also: AUC from results$X1 - AUC for lower bound #0.24 AUC from results$X2 -AUC for upper bound #0.98

And AUC built using the McNeil formula 0.53 & 0.92. Please check if my code is correct. Is it possible to use different statistics in one study, for example, bootstrap to calculate confidence intervals for the CAP curve, and another method to calculate confidence intervals for AUC. At the same time, focus on different confidence intervals for one study. While AUC, Gini with confidence intervals calculated by the McNeil formula appear in the same image with confidence intervals calculated by the bootstrap method and have different boundaries

Olesia
  • 1
  • 1

0 Answers0