HDiagnostic · Guide test 310
Venkatraman ROC curve test
Uses permutations to test equality of entire ROC curves, rather than just their areas.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Compare two ROC curves (paired) — Does one marker discriminate better than another on the same subjects?
In Compare two ROC curves (paired), choose Test = Venkatraman's permutation test (identical curves).
Do it in CodeSplash Run this test on your own data, in Python or R.
Bench
Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.
Bench · Venkatraman ROC curve test
Cases score this many SDs higher on marker 1.
Both markers are measured on the same people, so their errors correlate.
Your data
Simulated with known separationsThe two markers are measured on the same people, so their AUCs are correlated; DeLong compares the areas, Venkatraman–Begg the whole curves.
If H₀ were true
- The reference: how E varies across samples when H₀ is true, 500 paired swaps of the two markers' ranks (permutation null on the shared stream).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .008).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- the error curve of marker m at rank threshold k
- each person's two ranks are swapped at random (with jitter), keeping the pairing
The verdict
E = 340, p = .008
p ≤ α = .050: reject H₀
Tests the whole curve, so it reacts to curves that cross; it does not say which marker is better or where. Its p comes from permutations, so it moves slightly with their number.
- Statistic
- 340.000
- p-value
- 0.0080
Venkatraman ROC curve test on 30 cases and 30 controls, two markers each: E = 340, p = .008. The p-value is below α = .050, so the data are hard to reconcile with H₀.
Question and hypotheses
H0: two ROC curves are identical over the threshold range.
Assumptions
Independent subjects with correct paired/unpaired design; valid label/within-subject permutation under H0; score ranking and ties handled consistently.
Formula
Parameters and notation
u is false-positive rate; the rank-based Venkatraman statistic is a discrete integrated curve discrepancy, with implementation-specific scaling and rank tie rules.
Structure of the method
Use the published rank-based discrepancy and permutation scheme to compare the complete ROC curves. A simple integral of absolute ROC differences conveys the goal but is not a drop-in specification of every normalization, ranking or paired-permutation detail in the implemented Venkatraman algorithm.
Estimated and nuisance parameters
Empirical ranks and curve discrepancies are estimated from scores and outcomes; the permutation distribution supplies calibration. No smoothing bandwidth or fitted regression parameter is intrinsic to the standard rank test. Pairing and score direction are design inputs whose correct specification determines allowable rearrangements.
Settings and design choices
Choose paired/unpaired design, tie method, permutation count, score orientation and global curve alternative. pROC exposes ties.method and boot.n for this method and supports a two-sided comparison. Smoothed ROC curves are not supported for its Venkatraman implementation; do not silently treat a bootstrap AUC test as equivalent.
Fitting and adaptation
Use a validated implementation that preserves the intended null and pairing. If scores arise from fitted models, evaluate on an appropriate independent sample or account for fitting within a valid resampling framework. More permutations improve Monte Carlo precision but do not repair an invalid exchangeability assumption.
Sensitivity and robustness
Crossing curves can be detected even when AUCs are similar. A global discrepancy may be driven by an operating region irrelevant to the application, so complement it with prespecified threshold/region summaries. Heavy ties, small samples, identical rankings and perfect separation can create degenerate or unstable behavior; report numerical and permutation settings.
How to use and calibrate
Use the Venkatraman rank-permutation algorithm for paired or unpaired curves; recompute the complete statistic each replicate.
Example application
Detect crossing ROC curves whose total AUCs might be equal.
Interpretation and pitfalls
Watch out
Permuting outcomes indiscriminately is not the same null. Rejection concerns curve shape, not necessarily clinically relevant operating thresholds.
What changed in edition 2
- New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.
Python and R
Both predictions are on the same subjects. DeLong compares AUCs; Venkatraman tests equality of the ROC curves via permutation, a stronger/different target. Direction and event coding are fixed, not auto-selected.
Not run — Executed end to end through Rscript · needs Python standard library + Rscript; R packages: pROC
# Python launcher for the complete R implementation below.
# Requires Rscript on PATH and the listed R packages.
import shutil
import subprocess
rscript = shutil.which("Rscript")
if rscript is None:
raise RuntimeError("Install R and make Rscript available on PATH.")
r_code = r"""
set.seed(2026)
truth<-rep(c(0,1),each=60);score1<-truth+rnorm(120);score2<-.7*truth+rnorm(120);a<-pROC::roc(truth,score1,levels=c(0,1),direction="<",quiet=TRUE);b<-pROC::roc(truth,score2,levels=c(0,1),direction="<",quiet=TRUE)
print(pROC::roc.test(a,b,paired=TRUE,method="venkatraman",boot.n=999))
"""
# No shell interpolation. A failed R execution raises an error in Python.
result = subprocess.run([rscript, "--vanilla", "-"], input=r_code,
text=True, capture_output=True)
print(result.stdout)
if result.stderr:
print(result.stderr)
result.check_returncode()
Validated — Executed successfully in the validation environment · needs pROC
set.seed(2026)
truth<-rep(c(0,1),each=60);score1<-truth+rnorm(120);score2<-.7*truth+rnorm(120);a<-pROC::roc(truth,score1,levels=c(0,1),direction="<",quiet=TRUE);b<-pROC::roc(truth,score2,levels=c(0,1),direction="<",quiet=TRUE)
print(pROC::roc.test(a,b,paired=TRUE,method="venkatraman",boot.n=999))
Output
Venkatraman's test for two paired ROC curves data: a and b E = 462, boot.n = 999, p-value = 0.4885 alternative hypothesis: true difference in at least one ROC operating point is not equal to 0
Sources
- pROC — pROC · roc.testAuthor documentation/source reviewed: pROC 1.19.1.search.r-project.org
- roc.testsearch.r-project.org
- rocsearch.r-project.org
- Statistics guide v4 (historical):
- Python: Executed end to end through Rscript · R: Executed successfully in the validation environment
- Reference's record:
- Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Python-to-R bridge; Rscript is unavailable. R code was not executed. Python: Not run in the reference's review: Python-to-R bridge; Rscript is unavailable. R code was not executed. R: Reviewed but not run: R wasn't available to the reference's authors.
From the CodeSplash statistics guide (v4), entry 310, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT310.