This function computes for values of a continuous variable of a group of cases and a group of controls the ROC curve. Additionally, the AUC including an asymptotic confidence interval is provided.

1 | ```
summaryROC(cases, controls, conf.level = 0.95)
``` |

`cases` |
Values of the continuous variable for the cases. |

`controls` |
Values of the continuous variable for the controls. |

`conf.level` |
Confidence level of confidence interval. |

`x.val` |
1-specificity of the test, so the values on the |

`y.val` |
Sensitivity of the test, so the values on the |

`ppvs` |
Positive predictive values for each cutoff. |

`npvs` |
Negative predictive values for each cutoff. |

`cutoffs` |
Cutoffs used (basically the pooled marker values of cases and controls). |

`res.mat` |
Collects the above quantities in a matrix, including Wilson confidence intervals, computed at at confidence level |

`auc` |
Area under the ROC curve. This is equal to the value of the Mann-Whitney test statistic. |

`auc.var` |
Variance of AUC. |

`auc.var.norm` |
Variance of AUC if data is assumed to come from a bivariate normal distribution. |

`lowCI` |
Lower limit of Wald confidence interval. |

`upCI` |
Upper limit of Wald confidence interval. |

`logitLowCI` |
Lower limit of a Wald confidence interval received on logit scale. |

`logitUpCI` |
Upper limit of a Wald confidence interval received on logit scale. |

The confidence intervals are only valid if observations are *independent*.

Kaspar Rufibach

kaspar.rufibach@gmail.com.
Part of the function was derived from code by Andrea Riebler.

The original reference for computation of confidence intervals is:

Hanley, J.A. and McNeil, B.J. (1982).
The meaning and use of the area under the curve.
*Radiology*, **143**, 29–36.

See also:

Pepe, M.S. (2003) *The statistical evaluation of medical tests for classification and prediction*.
Oxford: Oxford University Press.

Similar functionality is provided in the package ROCR. However, this latter package offers no computation of confidence intervals.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
set.seed(1977)
ns <- c(50, 40)
truth <- c(rep(0, ns[1]), rep(1, ns[2]))
estimates <- c(rnorm(ns[1]), rnorm(ns[2], mean = 0.5, sd = 1.5))
cases <- estimates[truth == 1]
controls <- estimates[truth == 0]
res <- summaryROC(cases, controls, conf.level = 0.95)
# display results
res
res$res.mat
# plot ROC curve
plot(0, 0, xlim = c(0, 1), ylim = c(0, 1), type = 'l',
xlab = "1 - specificity", ylab = "sensitivity", pty = 's')
segments(0, 0, 1, 1, lty = 2)
lines(res$x.val, res$y.val, type = 'l', col = 2, lwd = 2, lty = 2)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.