ROCsurvcomp is an R package for comparing survival curves under non-proportional hazards (non-PH) using ROC-based methods. Traditional log-rank test may lose power when the proportional hazards assumption is violated. Other methods, such as the Fleming-Harrington (FH) family of weighted log-rank tests require prior knowledge of the underlying non-PH patterns, and incorrectly specified patterns may lead to a substantial loss of statistical power. This package provides alternative approaches for comparing survival curves based on ROC curve, without requiring prior knowledge of the underlying non-PH pattern, and can accommodate right, left, and doubly censored data.
You can install the package from GitHub:
# install.packages("remotes") # if not installed
remotes::install_github("mmrahman13/ROCsurvcomp")library(ROCsurvcomp)
library(PWEXP)
# Generating right-censored data with crossing survivals
set.seed(126)
n_trt <- 50
break_trt <- c(2, 4)
rate_trt <- c(log(2)/3, log(2)/7, log(2)/20)
rate.censor_trt <- c(log(2)/55, log(2)/62, log(2)/68)
event_trt <- PWEXP::rpwexp(n_trt, rate = rate_trt, breakpoint = break_trt)
censor_trt <- PWEXP::rpwexp(n_trt, rate = rate.censor_trt, breakpoint = break_trt)
n_ctrl <- 50
rate_ctrl <- log(2)/10
rate.censor_ctrl <- log(2)/58
event_ctrl <- rexp(n_ctrl, rate = rate_ctrl)
censor_ctrl <- rexp(n_ctrl, rate = rate.censor_ctrl)
# Observed time and censoring status (0 = event, 1 = right-censored)
time_trt <- pmin(event_trt, censor_trt)
status_trt <- ifelse(event_trt <= censor_trt, 0, 1)
time_ctrl <- pmin(event_ctrl, censor_ctrl)
status_ctrl <- ifelse(event_ctrl <= censor_ctrl, 0, 1)
time <- c(time_trt, time_ctrl)
status <- c(status_trt, status_ctrl)
group <- c(rep(1, n_trt), rep(2, n_ctrl))
# Run `surv.comp()` function
# Note: n_perm = 1000 is used here only for illustration purposes. Highly recommended n_perm to be set at 50,000 or more.
surv.comp(
time = time,
status = status,
group = group,
censor_type = "right",
method = "joint_method",
n_perm = 1000,
progress = TRUE,
plot = TRUE
)This package implements ROC-based approaches for comparing two survival curves:
These methods are especially useful when: - The proportional hazards assumption is violated - Treatment effects are not constant over time and no prior information about the pattern of effects is available - Survival curves cross.
Mohammod Mahmudur Rahman
PhD Student, Department
of Biostatistics & Data Science
University of Kansas Medical
Center
Leonidas Bantis
Associate Professor, Department
of Biostatistics & Data Science
University of Kansas Medical
Center