dx_delong: DeLong's Test for Comparing Two ROC Curves

View source: R/dx_tests.R

dx_delongR Documentation

DeLong's Test for Comparing Two ROC Curves

Description

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.

Usage

dx_delong(dx1, dx2, detail = "full", paired = TRUE)

Arguments

dx1

A dx object containing the first ROC curve.

dx2

A dx object containing the second ROC curve.

detail

Character specifying the level of detail in the output: "simple" for p-value only, "full" for detailed test results.

paired

Logical indicating if data between dx1 and dx2 is paired.

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 confidence interval gives a range of plausible values for the difference in AUC between the two 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.

See Also

pROC::roc.test() for the underlying test implementation.

dx_cm() to understand how 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)
print(detailed)

overdodactyl/diagnosticSummary documentation built on Jan. 28, 2024, 10:07 a.m.