pr.test | R Documentation |
Test the hypothesis that the true difference in PR AUCs is equal to 0.
We implement the same bootstrap method based on the idea from pROC::roc.test()
.
The PR AUC is calculated using PRROC::pr.curve()
with the interpolation
method of Davis (2006).
pr.test(
labels,
pred1,
pred2,
boot.n = 10000,
boot.stratified = TRUE,
alternative = "two.sided"
)
labels |
( |
pred1 |
( |
pred2 |
( |
boot.n |
( |
boot.stratified |
( |
alternative |
( |
a list with the AUCs of the two original prediction vectors and the p-value of the bootstrap-based test.
Davis J, Goadrich M (2006). “The relationship between precision-recall and ROC curves.” Proceedings of the 23rd International Conference on Machine Learning, 148(4), 233–240. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1145/1143844.1143874")}.
set.seed(42)
# imbalanced labels
labels = sample(c(0,1), 20, replace = TRUE, prob = c(0.8,0.2))
# predictions
pred1 = rnorm(20)
pred2 = rnorm(20)
pr.test(labels, pred1, pred2, boot.n = 1000, boot.stratified = FALSE)
pr.test(labels, pred1, pred2, boot.n = 1000, boot.stratified = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.