This function applies DeLong's test to compare the areas under two correlated ROC curves, providing a statistical approach to assess if there is a significant difference between them. It's particularly useful for comparing the performance of two diagnostic models.
Value
Depending on the detail parameter, returns a p-value or a comprehensive
summary of the test including the test statistic, p-value, and confidence interval
for the difference in AUC.
Details
The function utilizes the roc.test function from the pROC package to perform
DeLong's test, which is suitable for comparing two correlated ROC curves. This correlation
typically arises from using the same set of samples to generate both curves. A significant
p-value indicates a statistically significant difference between the AUCs of the two models.
When detail is "full", additional information about the comparison, including the estimated
difference in AUC and its confidence interval, is provided. The difference is calculated
as the AUC of dx1 minus the AUC of dx2, so a negative estimate indicates that dx2
has the higher AUC. The confidence interval gives a range of plausible values for the
difference in AUC between the two models. A confidence interval is only available for
paired comparisons.
The p-value is NA when either curve has fewer than two cases or two controls, since
DeLong's variance is undefined.
Paired comparisons use DeLong's Z statistic and the standard normal distribution.
Unpaired comparisons use the t statistic from pROC::roc.test(), with
Welch-Satterthwaite degrees of freedom, and the t distribution. The notes
column says which statistic is reported in statistic.
See also
pROC::roc.test() for the underlying test implementation.
dx() to create a dx object.
Examples
dx_glm <- dx(data = dx_heart_failure, true_varname = "truth", pred_varname = "predicted")
dx_rf <- dx(data = dx_heart_failure, true_varname = "truth", pred_varname = "predicted_rf")
simple <- dx_delong(dx_glm, dx_rf, detail = "simple")
detailed <- dx_delong(dx_glm, dx_rf)
print(simple)
#> [1] 0.0005886491
print(detailed)
#> # A tibble: 1 × 9
#> models test summary p_value estimate conf_low conf_high statistic notes
#> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <chr>
#> 1 "" DeLong's t… 0.04 (… 5.89e-4 0.0413 0.0178 0.0649 3.44 Z st…
