Compute ROC AUC and confidence intervals using DeLong’s method
Project description
pAUC: A simple Python package to calculate ROC AUC confidence intervals using DeLong’s method
📌 Installation
pip install pauc
📌 Quick Usage
from pauc import roc_auc_ci_score
import numpy as np
y_true = np.array([0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1])
y_pred = np.array([0.1, 0.35, 0.24, 0.8, 0.2, 0.85, 0.13, 0.85, 0.74, 0.58, 0.71, 0.25])
auc, (lb, ub) = roc_auc_ci_score(y_true, y_pred)
print(f'AUC: {auc:.3f}, 95% CI: ({lb:.3f}, {ub:.3f})')
AUC: 0.708
95% CI: (0.378, 1.000)
📌 Comparing Two Models
from pauc.roc_auc_ci import delong_roc_test
import numpy as np
y_true = np.array([0, 0, 1, 1, 0, 1, 0])
pred1 = np.array([0.1, 0.35, 0.4, 0.8, 0.2, 0.75, 0.1])
pred2 = np.array([0.5, 0.92, 0.1, 0.1, 0.8, 0.95, 0.9])
log_pval = delong_roc_test(y_true, pred1, pred2)
p_value = 10 ** log_pval
print(f"DeLong’s test p-value: {p_value}")
📌 Plot ROC Curve with Confidence Interval
rom pauc import plot_roc_with_ci
plot_roc_with_ci(y_true, y_pred)
This displays:
- ✅ Mean ROC curve
- 📉 Shaded 95% CI band from bootstrapping
- 📈 AUC with TPR envelope AUC range in the legend
- ℹ️ TPR envelope range is not a formal statistical CI—it's the area under the lower/upper percentile ROC curves.
📌 Why DeLong’s Test?
DeLong’s method (DeLong et al. 1988, Sun and Xu 2014) is:
- 📈 Statistically robust and widely used
- ✅ Ideal for estimating AUC confidence intervals
- 🔁 Suitable for comparing correlated ROC curves
📌 Citation
If you use pAUC, please cite:
-
DeLong et al., Biometrics, 1988:
Comparing the areas under two or more correlated ROC curves: a nonparametric approach -
Sun & Xu, IEEE Signal Processing Letters, 2014:
Fast Implementation of DeLong’s Algorithm for Comparing the Areas Under Correlated ROC Curves
📌 License
Released under the MIT License.
✨ Enjoy using pAUC for statistically sound AUC comparisons!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pauc-0.1.6.tar.gz.
File metadata
- Download URL: pauc-0.1.6.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c50a5ada71f8ffaadf561a4a385906c11772079498783e02846359973b6d579c
|
|
| MD5 |
bc20ff7725918abe897c72ca62e93b89
|
|
| BLAKE2b-256 |
9003cc3cd7bc31647b307f5835da1ef569a1fe9c7b0d19d3a61da536eb25982e
|
File details
Details for the file pauc-0.1.6-py3-none-any.whl.
File metadata
- Download URL: pauc-0.1.6-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a91c52268f8f54eabc5a739cf33f8f2f354eaafc7fc136e40926c346bd25d6fc
|
|
| MD5 |
406fc030737c3929010c0117b414475b
|
|
| BLAKE2b-256 |
f185236747966341a973fe7cf1eb7b72bd65a69bf241082bf18e9aac52b9b94c
|