Getting numbers of true positives, negatives, likelihood ratio from a pROC ROC curve

24 views Asked by At

I have an analysis using pROC package to assess the performance of a blood test for detection of an outcome (binary). I have used pROC and bootstrapping to select the optimum threshold (using closest top left) and to give sensitivity and specificity at thresholds to determine 90 and 95% sensitivity.

I would like to determine the likelihood ratio (and 95% CI) at each threshold, anyone have any tips for getting this out of pROC with 95% CI (bootstrapped)

Reproducible example:

set.seed(42)

num_subjects <- 40

continuous_variable <- rnorm(num_subjects, mean = 50, sd = 10)

probability_of_one <- 1 / (1 + exp(-0.1 * (continuous_variable - 50)))
binary_variable <- rbinom(num_subjects, 1, probability_of_one)

df <- data.frame(
  Continuous_Variable = continuous_variable,
  Binary_Variable = binary_variable
)

print(df)

Current attempt:

ROC_1 = pROC::roc(response = df$binary_variable, predictor = df$continuous_variable, ci=TRUE)
pROC::auc(continuous_variable) #0.9247
pROC::ci.auc(continuous_variable, conf.level=0.95, method=c("bootstrap"), boot.n = 2000) 
d <- coords(continuous_variable, x="all")
coords(continuous_variable, x="best", best.method=c("closest.topleft"))

pROC::coords(ROC_1 , x=THRESHOLD, ret=c("tn", "tp", "fn", "fp"))
pROC::ci.coords(ROC_1 , x=-THRESHOLD, ret=c("tn", "tp", "fn", "fp"))

Note THRESHOLD is manually inputted depending on the threshold desired

0

There are 0 answers