pROC 1.5 released
pROC's steady progression goes on with version 1.5. It is avalable for R only. S+ users will need to wait for the upcoming 1.6 release which will introduce power / sample size computations.
This version introduces four new notable features:
- Variance and covariance
- Univariate Log-Concave Density Estimation smoothing
- Improvements to the plotting function
- New return values in coords
Variance and covariance
It is now possible to compute the variance of a ROC curve, and the covariance of two paired ROC curves.
library(pROC) data(aSAH) rocobj <- roc(aSAH$outcome, aSAH$s100b) var(roc1) var(roc2) cov(roc1, roc2)
Two methods are available: bootstrap, DeLong1. The bootstrap is the most versatile method. DeLong is faster but works for full AUC only. For more details, see
Univariate Log-Concave Density Estimation smoothing
Until now, three methods were available to smooth a ROC curve:
fitdistr (to fit a distribution with MASS). Now, two new methods are available:
logcondens.smooth. They are based on Duembgen and Rufibach (2011)2. You first need to install the logcondens package:
It doesn't need to be loaded.
plot(rocobj) rs <- smooth(rocobj, method="binormal") plot(rs, add=TRUE, col="green") rs2 <- smooth(rocobj, method="density") plot(rs2, add=TRUE, col="blue") rs3 <- smooth(rocobj, method="fitdistr", density="lognormal") plot(rs3, add=TRUE, col="magenta") rs4 <- smooth(rocobj, method="logcondens") plot(rs4, add=TRUE, col="brown") rs5 <- smooth(rocobj, method="logcondens.smooth") plot(rs5, add=TRUE, col="orange") legend("bottomright", legend=c("Empirical", "Binormal", "Density", "Log-normal", "Log-concave density", "Smoothed log-concave density"), col=c("black", "green", "blue", "magenta", "brown", "orange"), lwd=2)
Improvements to the plotting function
Several users have been bothered by the fact than in pROC (R version), the sensitivity is plotted as decreasing specificity. Most other software plot increasing 1 – specificity on the X axis. The reason is purely historical: only few statistical software can plot an axis in decreasing direction. For instance S+ cannot do it, and pROC's ROC curve are plotted as 1 – specificity there. However it makes absolutely no difference on the ROC curve itself. As it was possible, I decided plot the modern version on R rather than stick to obsolete conventions.
For those who are disturbed and prefer to stick to obsolete conventions, pROC 1.5 comes with a way to plot increasing 1 – specificity in the R version with the
Note that it makes no difference to the coordinates of the plot, and if you want to add some text you still have to think in the "new" way. Consequently, the following will always be plotted to the top left corner of the curve, whatever
legacy.axes you specified:
text(1, 1, auc(rocobj), adj=c(0, 1))
New return values in coords
retargument of the
coords function now accepts several new values:
- "accuracy": (sensivity + specificity) / 2
- "tn": true positives count
- "tp": true negatives count
- "fn": false negtives count (positive observations classified as negative by
- "fp": false positives count (negative observations classified as positive by
- "npv": negative predictive value, or tn / (tn + fn)
- "ppv": positive predictive value, or tp / (tp + fp)
In addition, sensitivity, specificity, npv and ppv can be prefixed with
1- in order to get the opposite value. Finally two additional values are recognized:
- "npe": converted to 1-npv
- "ppe": converted to 1-ppv
Here is an example. We take the best threshold of the ROC curve
rocobj and display all the parameters of this threshold:
coords(rocobj, "best", ret=c("threshold", "specificity", "sensitivity", "accuracy", "tn", "tp", "fn", "fp", "npv", "ppv", "1-specificity", "1-sensitivity", "1-npv", "1-ppv"))
Coords also accepts a new argument:
drop to control the dimension of the return value. If
FALSE, a matrix will always be returned, even if it contains only one column. This is especially useful to make scripts more reliable.
Here is the full change log:
retvalues: "accuracy", "tn", "tp", "fn", "fp", "npv", "ppv", "1-specificity", "1-sensitivity", "1-npv", "1-ppv", "npe" and "ppe"
plot1-specificity rather than specificity
axesargument to turn off the plotting of the axis
logcondens.smooth(Univariate Log-Concave Density Estimation) smoothing methods
- New function
has.partial.aucto determine if an AUC is full or partial
- New argument
multiclass.aucobjects now also have secondary class
- Updated load call
- Delong's CI reversed in ROC curves with
- Delong's CI AUC returned values > 1 or < 0 in some rare cases
- Minor improvements in documentation
- 1. Elisabeth R. DeLong, David M. DeLong and Daniel L. Clarke-Pearson (1988) “Comparing the areas under two or more correlated receiver operating characteristic curves: a nonparametric approach”. Biometrics 44, 837–845.
- 2. Lutz Duembgen, Kaspar Rufibach (2011) “logcondens: Computations Related to Univariate Log-Concave Density Estimation”. Journal of Statistical Software, 39, 1–28. URL: jstatsoft.org/v39/i06.