Type: | Package |
Title: | Computing Sensitivity at a Fix Value of Specificity and Vice Versa as Well as Bootstrap Metrics for ROC Curves |
Version: | 0.3 |
Author: | E. F. Haghish |
Maintainer: | E. F. Haghish <haghish@uio.no> |
Description: | For a binary classification the adjusted sensitivity and specificity are measured for a given fixed threshold. If the threshold for either sensitivity or specificity is not given, the crossing point between the sensitivity and specificity curves are returned. For bootstrap procedures, mean and CI bootstrap values of sensitivity, specificity, crossing point between specificity and specificity as well as AUC and AUCPR can be evaluated. |
License: | MIT + file LICENSE |
Imports: | ROCit, ggplot2, boot, yardstick |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
URL: | https://github.com/haghish/adjROC, https://www.sv.uio.no/psi/english/people/aca/haghish/ |
BugReports: | https://github.com/haghish/adjROC/issues |
NeedsCompilation: | no |
Packaged: | 2023-01-25 15:01:14 UTC; haghish |
Repository: | CRAN |
Date/Publication: | 2023-01-25 15:50:09 UTC |
adjroc
Description
computes adjusted sensitivity, adjusted specificity, or the crossing point between sensitivity and specificity for different thresholds
Usage
adjroc(
score,
class,
method = "emp",
sensitivity = NULL,
specificity = NULL,
plot = FALSE
)
Arguments
score |
A numeric array of diagnostic score i.e. the estimated probability of each diagnosis |
class |
A numeric array of equal length of |
method |
Specifies the method for estimating the ROC curve. Three methods are supported, which are |
sensitivity |
numeric. Specify the threshold of sensitivity |
specificity |
numeric. Specify the threshold of specificity |
plot |
logical. if TRUE, the sensitivity and specificity will be plotted |
Value
data.frame including cutoff point, and adjusted sensitivity and specificity based on the specified threshold
Examples
# random classification and probability score
score <- runif(10000, min=0, max=1)
class <- sample(x = c(1,0), 10000, replace=TRUE)
# calculate adjusted sensitivity, when specificity threshold is 0.90:
adjroc(score = score, class = class, specificity = 0.9, plot = TRUE)
# calculate adjusted specificity, when sensitivity threshold equals 0.9
adjroc(score = score, class = class, sensitivity = 0.9, plot = TRUE)
# calculate the meeting point between sensitivity and specificity
adjroc(score = score, class = class, plot = TRUE)
boot.adjroc
Description
computes bootstrap adjusted sensitivity, bootstrap adjusted specificity, or bootstrap crossing point between sensitivity and specificity for different thresholds
Usage
boot.adjroc(
score,
class,
n = 100,
method = "emp",
sensitivity = NULL,
specificity = NULL
)
Arguments
score |
A numeric array of diagnostic score i.e. the estimated probability of each diagnosis |
class |
A numeric array of equal length of |
n |
number of bootstrap samples. |
method |
Specifies the method for estimating the ROC curve. Three methods are supported, which are |
sensitivity |
numeric. Specify the threshold of sensitivity. |
specificity |
numeric. Specify the threshold of specificity. |
Value
list including mean and CI of bootstrap value (sensitivity, specificity, or the crossing point) and the bootstrap data.
Examples
# random classification and probability score
score <- runif(10000, min=0, max=1)
class <- sample(x = c(1,0), 10000, replace=TRUE)
# calculate adjusted sensitivity, when specificity threshold is 0.90:
adjroc(score = score, class = class, specificity = 0.9, plot = TRUE)
# calculate adjusted specificity, when sensitivity threshold equals 0.9
boot.adjroc(score = score, class = class, n = 100, sensitivity = 0.9)
# calculate the bootstrap meeting point between sensitivity and specificity
boot.adjroc(score = score, class = class, n = 100)
boot.roc
Description
computes bootstrap AUC and AUCPR for the ROC curve
Usage
boot.roc(
score,
class,
metric = "AUC",
n = 100,
method = "emp",
event_level = "first"
)
Arguments
score |
A numeric array of diagnostic score i.e. the estimated probability of each diagnosis |
class |
A numeric array of equal length of |
metric |
character. specify the metric of interest which can be
|
n |
number of bootstrap samples. |
method |
Specifies the method for estimating the ROC curve. Three methods
are supported, which are |
event_level |
character. only needed for bootstrapping AUCPR. this
argument specifies which level of the "class" should be
considered the positive event. the values can only be
|
Value
list including mean and CI of bootstrap value (sensitivity, specificity, or the crossing point) and the bootstrap data.
Examples
# random classification and probability score
score <- runif(10000, min=0, max=1)
class <- sample(x = c(1,0), 10000, replace=TRUE)
# calculate bootstrap AUC of the ROC curve
boot.roc(score = score, class = class, n = 100, metric = "AUC")
# calculate bootstrap AUCPR of the ROC curve
boot.roc(score = score, class = class, n = 100, metric = "AUCPR")