Crandore Hub

ROCsurvcomp

ROC-Based Methods for Comparing Survival Distributions with Right, Left, and Doubly Censored Data

Implements nonparametric and semiparametric methods for comparing two survival distributions under non-proportional hazards (non-PH). The methods are based on the Receiver Operating Characteristic (ROC) curve length (Bantis et al. (2021) <doi:10.1002/sim.8869>) and the overlap coefficient (OVL) (Franco-Pereira et al. (2021) <doi:10.1177/09622802211046386>), as well as a joint ROC length-OVL-based approach. These methods do not require prior knowledge of the underlying non-PH pattern and can accommodate right, left, and doubly censored data.

README

# ROCsurvcomp

## Overview

**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.

## Key Features

- Implements nonparametric and semiparametric kernel-based approaches for comparing two survival distributions
- Designed for handling *non-proportional hazards* settings
- Methods include:
  - ROC length-based test
  - Overlap coefficient (OVL)-based test
  - Joint ROC length-OVL-based test
- Supports right, left and doubly-censored survival data
- Permutation-based inference with two-sided hypothesis testing


## Installation

You can install the package from GitHub:

```r
# install.packages("remotes")    # if not installed
remotes::install_github("mmrahman13/ROCsurvcomp")
```


## Usage

### Basic Example

```r
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
)
```

## Methodology

This package implements ROC-based approaches for comparing two survival curves:

- **ROC Length**: Measures separation between two distributions without relying on any stochastic ordering
- **Overlap Coefficient (OVL)**: Quantifies the similarity between two distributions using the common area between two probability density functions
- **Joint Test**: Combines ROC length and OVL-based methods by constructing convex hull of the permuted samples based on their Euclidean distance from the origin.

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.


---

## Authors

**Mohammod Mahmudur Rahman**<br>
PhD Student, Department of Biostatistics & Data Science<br>
University of Kansas Medical Center

**Leonidas Bantis**<br>
Associate Professor, Department of Biostatistics & Data Science<br>
University of Kansas Medical Center

Versions across snapshots

VersionRepositoryFileSize
0.1.2 rolling linux/jammy R-4.5 ROCsurvcomp_0.1.2.tar.gz 692.1 KiB
0.1.2 rolling linux/noble R-4.5 ROCsurvcomp_0.1.2.tar.gz 692.1 KiB
0.1.2 rolling source/ R- ROCsurvcomp_0.1.2.tar.gz 692.1 KiB
0.1.2 latest linux/jammy R-4.5 ROCsurvcomp_0.1.2.tar.gz 692.1 KiB
0.1.2 latest linux/noble R-4.5 ROCsurvcomp_0.1.2.tar.gz 692.1 KiB
0.1.2 latest source/ R- ROCsurvcomp_0.1.2.tar.gz 692.1 KiB
0.1.2 2026-04-23 source/ R- ROCsurvcomp_0.1.2.tar.gz 0 B

Dependencies (latest)

Imports

Suggests