I have a dataset with a continuous biomarker (predictor), binary outcome, and a binary covariate. I'm building a covariate-adjusted ROC curve using the ROCnReg package in R (function AROC.bnp()). At a specified false positive fraction (FPF), I can obtain covariate-specific thresholds. However, I cannot find a way to get the covariate-specific true positive fractions (TPFs, i.e., sensitivities).
Here's an example dataset:
set.seed(123) # Set seed for reproducibility
n <- 500 # Number of observations
# Simulate continuous variable
continuous_var <- runif(n, min = 1, max = 200)
# Simulate binary outcome
outcome <- rbinom(n, size = 1, prob = plogis(0.05 * (continuous_var - 100)))
# Simulate binary covariate
covariate <- rbinom(n, size = 1, prob = 0.4)
covariate <- as.factor(covariate)
# Create the simulated dataset
simulated_data <- data.frame(ContinuousVar = continuous_var,
Outcome = outcome,
Covariate = covariate)
# Run the covariate-adjusted ROC curve
aroc <- AROC.bnp(formula.h = ContinuousVar ~ Covariate,
group = "Outcome",
tag.h = 0, data = simulated_data)
I then compute the covariate-specific thresholds at an FPF of 0.20 (specificity of 0.80), using the function compute.threshold.AROC():
compute.threshold.AROC(aroc, criterion="FPF", FPF = 0.2)
This gives me threshold of 99.42 for covariate level = 0, and 88.64 for covariate level = 1. However, the output does not give me covariate-specific TPFs. How would I go about calculating them?
Thank you for your help!