Inference for Cumulative Incidence Curves

Zachary McCaw
Updated: 20-12-24

knitr::opts_chunk$set(cache = TRUE)

Description

This package provides functions for inference on the difference in AUCs, event rates, and quantiles comparing two cumulative incidence curves. Also see MCC for inference on mean cumulative count curves.

Installation

```{R, eval=FALSE} devtools::install_github(repo = "zrmacc/CICs")

## Examples

### Data

The function `GenTwoSampleData` simulates example data in the format expected by this package. The censoring, event, and death times are drawn from independent exponential distributions. Note that 'rate' refers to the arrival rate of the corresponding exponential rather than the proportion of the sample. 

```{R}
library(CICs)

# Generate data.
data <- GenTwoSampleData(
  n1 = 200,
  n0 = 200,
  censor_rate1 = 0.25,
  censor_rate0 = 0.25,
  event_rate1 = 0.50,
  event_rate0 = 0.75,
  death_rate1 = 0.25,
  death_rate0 = 0.25
)

# Add strata.
strata <- rmultinom(n = 400, size = 1, prob = c(0.3, 0.4, 0.3))
data$strata <- apply(strata, 2, which.max)
head(data)

In these data, arm is the treatment arm, 0 for reference, 1 for treatment; time is the observation time; and status is the event type, 0 for censoring, 1 for an event, 2 for death. For analysing other data sets, arm should likewise be coded as 0/1, and status as 0/1/2, with status 1 identifying the event of interest.

Compare AUCs

To find a confidence interval and p-vaue for the difference and ratio in areas under the cumulative incidence curve at time $\tau = 2$:

aucs <- CompareCICs(
  time = data$time,
  status = data$status,
  arm = data$arm,
  strata = data$strata,
  sum_stat = "AUC",
  param = 2,
  reps = 100,
  alpha = 0.05
)
show(aucs)

Replace "AUC" by "AOC" for area over the cumulative incidence curve.

Compare Event Rates

For inference on the difference and ratio of event rates at $\tau = 2$:

rates <- CompareCICs(
  time = data$time,
  status = data$status,
  arm = data$arm,
  strata = data$strata,
  sum_stat = 'Rate',
  param = 2,
  reps = 100,
  alpha = 0.05
)
show(rates)

Compare Medians

To compare the difference and ratio of medians:

quants <- CompareCICs(
  time = data$time,
  status = data$status,
  arm = data$arm,
  strata = data$strata,
  sum_stat = 'Quantile',
  param = 0.5,
  reps = 100,
  alpha = 0.05
)
show(quants)


zrmacc/CICs documentation built on Nov. 6, 2024, 1:26 a.m.