rrocproc-r-package

Using pROC package in R to obtain CI for SP and SN from specific threshold


Using the pROC package, is anyone aware of a way to get confidence intervals for SP and SN with an input of a specific threshold value, rather than a specific SP or SN value? ci() appears to only display SP and SN values using their corresponding SN or SP's as an argument; I can ask for the CI of SP at an SN of 0.8, but not for the CI of SP at a threshold value of 9.0.

I understand that I can just find the SP/SN values for a threshold and then use these as arguments for ci(), but that seems clumsy. Of course, this may just end up being a question for the package developers.

Thanks in advance for any help you can provide.


Solution

  • Confidence intervals for SN and SP can be calculated for specified thresholds as an option when the roc object is first created as well as from ci.thresholds(rocobj, thresholds=0.9)

    With sample data from the help files for pROC:

    library(pROC)
    data(aSAH)
    
    rocobj <- roc(aSAH$outcome, aSAH$s100b, ci=TRUE, of="thresholds", thresholds=0.9)
    

    giving

    95% CI (2000 stratified bootstrap replicates):
     thresholds sp.low sp.median sp.high se.low se.median se.high
            0.9      1         1       1      0   0.04878   0.122