Are two ROC curves paired?

This function determines if two ROC curves can be paired.

programming, logic, ROC
# S3 method for auc
are.paired(roc1, roc2, ...)
# S3 method for smooth.roc
are.paired(roc1, roc2, ...)
# S3 method for roc
are.paired(roc1, roc2, return.paired.rocs=FALSE,
  reuse.auc = TRUE, = FALSE, reuse.smooth=TRUE, ...)
roc1, roc2

the two ROC curves to compare. Either “roc”, “auc” or “smooth.roc” objects (types can be mixed).


if TRUE and the ROC curves can be paired, the two paired ROC curves with NAs removed will be returned.

reuse.auc,, reuse.smooth

if return.paired.rocs=TRUE, determines if auc, ci and smooth should be re-computed (with the same parameters than the original ROC curves)

additionnal arguments for are.paired.roc. Ignored in are.paired.roc


Two ROC curves are paired if they are built on two variables observed on the same sample.

In practice, the paired status is granted if the response and levels vector of both ROC curves are identical. If the responses are different, this can be due to missing values differing between the curves. In this case, the function will strip all NAs in both curves and check for identity again.

It can raise false positives if the responses are identical but correspond to different patients.


TRUE if roc1 and roc2 are paired, FALSE otherwise.

In addition, if TRUE and return.paired.rocs=TRUE, the following atributes are defined:

roc1, roc2

the two ROC curve with all NAs values removed in both curves.

See Also

roc, roc.test

  • are.paired
  • are.paired.smooth.roc
  • are.paired.auc
  • are.paired.roc
aSAH.copy <- aSAH

# artificially insert NAs for demonstration purposes
aSAH.copy$outcome[42] <- NA
aSAH.copy$s100b[24] <- NA
aSAH.copy$ndka[1:10] <- NA

# Call roc() on the whole data
roc1 <- roc(aSAH.copy$outcome, aSAH.copy$s100b)
roc2 <- roc(aSAH.copy$outcome, aSAH.copy$ndka)
# are.paired can still find that the curves were paired
are.paired(roc1, roc2) # TRUE

# Removing the NAs manually before passing to roc() un-pairs the ROC curves
nas <-$outcome) |$ndka)
roc2b <- roc(aSAH.copy$outcome[!nas], aSAH.copy$ndka[!nas])
are.paired(roc1, roc2b) # FALSE

# Getting the two paired ROC curves with additional smoothing and ci options
roc2$ci <- ci(roc2)
paired <- are.paired(smooth(roc1), roc2, return.paired.rocs=TRUE,
paired.roc1 <- attr(paired, "roc1")
paired.roc2 <- attr(paired, "roc2")

# }
Documentation reproduced from package pROC, version 1.16.2, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.