CompareAUCs: Inference on the Area Under the Cumulative Count Curve

View source: R/Main.R

CompareAUCsR Documentation

Inference on the Area Under the Cumulative Count Curve

Description

Confidence intervals and p-values for the difference and ratio of areas under the mean cumulative count curves, comparing treatment (arm = 1) with reference (arm = 0).

Usage

CompareAUCs(
  data,
  alpha = 0.05,
  arm_name = "arm",
  boot = FALSE,
  cens_after_last = TRUE,
  covars = NULL,
  idx_name = "idx",
  perm = FALSE,
  reps = 2000,
  status_name = "status",
  strata = NULL,
  tau = NULL,
  time_name = "time",
  weights = NULL
)

Arguments

data

Data.frame.

alpha

Type I error level.

arm_name

Name of column containing treatment arm. Must be coded as 1 for treatment, 0 for reference.

boot

Logical, construct bootstrap confidence intervals (slow)?

cens_after_last

Should subjects who lack an explicit censoring time be censored after their last observed event?

covars

Optional covariate matrix. Rows should correspond with the subject index 'idx'. Factor and interaction terms should be expanded.

idx_name

Name of column containing a unique subject index.

perm

Logical, perform permutation test (slow)?

reps

Number of replicates for bootstrap/permutation inference.

status_name

Name of column containing the status. Must be coded as 0 for censoring, 1 for event, 2 for death. Each subject should have an observation-terminating event, either censoring or death.

strata

Optional stratification factor. Should not be provided if a covariate matrix is provided.

tau

Numeric truncation time.

time_name

Name of column containing the observation time.

weights

Optional column of weights, controlling the size of the jump in the cumulative count curve at times with status == 1.

Details

Two methods of p-value calculation are available. For 'perm', treatment assignments are permuted on each iteration, and the p-value is the proportion of the *null* statistics that are as or more extreme than the *observed* statistics. For 'boot', the p-value is twice the proportion of bootstrap replicates on which the sign of the difference is areas is reversed.

Value

Object of class compAUCs with these slots:

  • '@Areas': The AUC for each arm.

  • '@CIs': Observed difference and ratio in areas with confidence intervals.

  • '@Curves': Mean cumulative count curve for each arm; averaged across strata if present.

  • '@Pvals': Bootstrap and permutation p-values.

  • '@Reps': Bootstrap and permutation realizations of the test statistics.

  • '@Weights': Per-stratum weights and AUCs.

Examples


# Simulate data set.
covariates <- data.frame(arm = c(rep(1, 50), rep(0, 50)))
data <- GenData(
  beta_event = log(0.5),
  covariates = covariates
)

aucs <- CompareAUCs(
  data,
  tau = 2,
  boot = TRUE,
  perm = TRUE,
  reps = 25,
  alpha = 0.05
)
show(aucs)


zrmacc/MCC documentation built on July 16, 2025, 4:04 p.m.