pROC 1.16.0
pROC version 1.16.0 is available on CRAN now. Besides several bug fixes, the main change is the switch of the default value of the transpose
argument to the coords
function from TRUE
to FALSE
. As announced earlier, this is a backward incompatible change that will break any script that did not previously set the transpose
argument and for now comes with a warning to make debugging easier. Scripts that set transpose explicitly are not unaffected.
New return values of coords
and ci.coords
With transpose = FALSE
, the coords
returns a tidy data.frame
suitable for use in pipelines:
data(aSAH) rocobj <- roc(aSAH$outcome, aSAH$s100b) coords(rocobj, c(0.05, 0.2, 0.5), transpose = FALSE) # threshold specificity sensitivity # 0.05 0.05 0.06944444 0.9756098 # 0.2 0.20 0.80555556 0.6341463 # 0.5 0.50 0.97222222 0.2926829
The function doesn't drop dimensions, so the result is always a data.frame
, even if it has only one row and/or one column.
If speed is of utmost importance, you can get the results as a non-transposed matrix instead:
coords(rocobj, c(0.05, 0.2, 0.5), transpose = FALSE, as.matrix = TRUE) # threshold specificity sensitivity # [1,] 0.05 0.06944444 0.9756098 # [2,] 0.20 0.80555556 0.6341463 # [3,] 0.50 0.97222222 0.2926829
In some scenarios this can be a tiny bit faster, and is used internally in ci.coords
.
Type help(coords_transpose)
for additional information.
ci.coords
The ci.coords
function now returns a list-like object:
ciobj <- ci.coords(rocobj, c(0.05, 0.2, 0.5)) ciobj$accuracy # 2.5% 50% 97.5% # 1 0.3628319 0.3982301 0.4424779 # 2 0.6637168 0.7433628 0.8141593 # 3 0.6725664 0.7256637 0.7787611
The print
function prints a table with all the results, however this table is generated on the fly and not available directly.
ciobj # 95% CI (2000 stratified bootstrap replicates): # threshold sensitivity.low sensitivity.median sensitivity.high # 0.05 0.05 0.9268 0.9756 1.0000 # 0.2 0.20 0.4878 0.6341 0.7805 # 0.5 0.50 0.1707 0.2927 0.4390 # specificity.low specificity.median specificity.high accuracy.low # 0.05 0.01389 0.06944 0.1250 0.3628 # 0.2 0.70830 0.80560 0.8889 0.6637 # 0.5 0.93060 0.97220 1.0000 0.6726 # accuracy.median accuracy.high # 0.05 0.3982 0.4425 # 0.2 0.7434 0.8142 # 0.5 0.7257 0.7788
The following code snippet can be used to obtain all the information calculated by the function:
for (ret in attr(ciobj, "ret")) { print(ciobj[[ret]]) } # 2.5% 50% 97.5% # 1 0.9268293 0.9756098 1.0000000 # 2 0.4878049 0.6341463 0.7804878 # 3 0.1707317 0.2926829 0.4390244 # 2.5% 50% 97.5% # 1 0.01388889 0.06944444 0.1250000 # 2 0.70833333 0.80555556 0.8888889 # 3 0.93055556 0.97222222 1.0000000 # 2.5% 50% 97.5% # 1 0.3628319 0.3982301 0.4424779 # 2 0.6637168 0.7433628 0.8141593 # 3 0.6725664 0.7256637 0.7787611
Getting the update
The update his available on CRAN now. You can update your installation by simply typing:
install.packages("pROC")
Here is the full changelog:
- BACKWARD INCOMPATIBLE CHANGE:
transpose
argument tocoords
switched toFALSE
by default (issue #54). - BACKWARD INCOMPATIBLE CHANGE:
ci.coords
return value is now of list type and easier to use. - Fix one-sided DeLong test for curves with
direction=">"
(issue #64). - Fix an error in
ci.coords
due to expectedNA
values in some coords (like "precision") (issue #65). - Ordrered predictors are converted to numeric in a more robust way (issue #63).
- Cleaned up
power.roc.test
code (issue #50). - Fix pairing with
roc.formula
and warn ifna.action
is not set to"na.pass"
or"na.fail"
(issue #68). - Fix
ci.coords
not working withsmooth.roc
curves.
Xavier Robin
Publié le dimanche 12 janvier 2020 à 21:46 CET
Lien permanent : /blog/2020/01/12/proc-1.16.0
Tags :
pROC
Commentaires : 0