SPSS command: SPSS ROC ANALYSIS

Compare two ROC curves in your browser

ROC Analysis tests whether two areas under ROC curves differ.

Free · No account · Files stay on your device · Updated 18 October 2026

What it tells you

Crosstabs runs it on your device in both designs SPSS offers: two test variables measured on the same cases, compared with DeLong's paired test, or one test variable in two independent groups. It also draws precision-recall curves and lists every cutoff.

  • Whether two tests measured on the same people discriminate equally well, accounting for the correlation between them.
  • Whether one test performs differently in two subgroups, such as men and women or two hospitals.
  • The AUC difference with its standard error, z statistic and confidence interval.
  • How precision changes with recall, which is more informative than the ROC curve when positives are rare.

When to use it

Use it when

  • Replacing an expensive test with a cheaper one and asking whether discrimination drops.
  • Checking whether a risk model discriminates as well in a new population as in the development sample.
  • Comparing two classifiers' scores on the same validation set.

Use something else when

  • You only need one AUC or want up to four curves without a formal test: ROC Curve is simpler.
  • You want to compare more than two tests at once: run pairwise comparisons and correct for multiplicity.
  • The two tests were measured on different people but you treat them as paired: the DeLong test would be invalid; use the grouping-variable design.

How to run it in Crosstabs

  1. 01

    Open your data

    Open a file with one row per case and switch to Statistics mode.

  2. 02

    Choose ROC Analysis

    In the Agreement and diagnostics group, pick ROC Analysis (ROC ANALYSIS).

  3. 03

    Set the state and direction

    Choose the State variable, the Value of state variable (positive), the Test direction and the Confidence level (%).

  4. 04

    Paired design: two test variables

    Tick two Test variables measured on the same cases and leave the grouping variable empty; the paired DeLong comparison runs automatically.

  5. 05

    Independent design: one test, two groups

    Tick one Test variable, choose a Grouping variable (independent-group design, one test variable), then pick Group 1 and Group 2.

  6. 06

    Run

    Declare any weight as a frequency weight and press Run. With one test variable and no grouping variable you get its area alone.

Worked example

Computed by the Crosstabs engine from the synthetic data below when this page was built — not typed in.

Data

120 synthetic patients, 50 with the condition, each measured with a full laboratory test and a cheaper rapid test. Both scores share a common patient-level component, so they are correlated; the condition shifts the full test further than the rapid one. Fixed seed.

Area Under the ROC Curve
Test Result Variable(s)AreaStd. ErrorAsymptotic Sig.95% CIGini indexK-S
full_test0.8660.034<.0010.799 – 0.9340.7330.623
rapid_test0.6950.048<.0010.601 – 0.7900.3910.294

Paired-sample design: standard errors are DeLong's nonparametric estimates. Null hypothesis: true area = 0.5.

Paired-Sample Area Difference Under the ROC Curves
Test Result Pair(s)Asymptotic zAsymptotic Sig.AUC DifferenceStd. Error Difference95% CI
full_test – rapid_test4.016<.0010.1710.0430.087 – 0.254

Null hypothesis: the two areas are equal.

How to read it

The full test has AUC 0.866 and the rapid test 0.695. Because both were measured on the same patients, the DeLong test uses their covariance: the difference is 0.171 (95% CI 0.087 – 0.254), z = 4.02, p < .001. The covariance of the two areas is positive here, so treating the curves as independent would overstate the standard error of the difference.

Output tables explained

Area Under the ROC Curve
Area, standard error, significance against 0.5, confidence interval, Gini index and K-S for each curve. In the paired design the standard errors are DeLong's; otherwise they are Hanley-McNeil with ties.
Paired-Sample Area Difference Under the ROC Curves
Asymptotic z, significance, AUC difference, its standard error (using the covariance of the two areas) and confidence interval.
Independent-Group Area Difference Under the ROC Curves
The same columns for one test in two groups; the standard error of the difference is the square root of the sum of the two squared standard errors.
Coordinates of the Curve
One table per curve with sensitivity, 1 − specificity and precision at each cutoff; the precision-recall curve is drawn from these points.

Assumptions and notes

  • Paired design: both tests are measured on exactly the same cases with the same true state.
  • Independent design: the two groups contain different cases and each has both positives and negatives.
  • Large-sample normal approximation for the z test; with few positives or negatives the p value is approximate.
  • Weights must be declared as whole-number frequency weights; sampling weights stop the procedure.

How the results are validated

The paired DeLong comparison is checked against R pROC 1.19.1 roc.test on a 180-case weighted reference file: both areas agree to 1e-12, their variances and covariance to 1e-10, and z and p to 1e-9. The independent-groups z test combines the Hanley-McNeil standard errors validated on the ROC Curve page; it has no separate external reference test. Validation evidence

Questions

Why not just compare the two confidence intervals?

In a paired design the two AUCs are positively correlated because they share cases. Overlapping intervals can still hide a significant difference; the DeLong test uses the covariance and is more powerful.

Can I compare more than two test variables?

The panel accepts two at a time. For three or more, run each pair and adjust the p values, for example with Bonferroni.

When is the precision-recall curve more useful than the ROC curve?

When positives are rare, a small false-positive rate still means many false alarms. The precision-recall curve makes that visible, while the ROC curve can look excellent.

Do both tests need the same direction?

Yes, the panel applies one Test direction to both. If one score runs the opposite way, reverse it (for example multiply by −1) before running.

Run ROC Analysis on your own data

Open a .sav, CSV or Excel file. Everything runs in your browser; the file never leaves your device.

Open the workspace

SPSS is a trademark of IBM Corp. Crosstabs is not affiliated with or endorsed by IBM.