calc.AUC: Calculate the area under a ROC curve (AUC)

Description Usage Arguments Value Note Examples

View source: R/calc.AUC.R

Description

This function reads in a vector of sensitivity and a vector of specificity and calculates the area under the curve (AUC) by trapezoidal integration.

Usage

1
calc.AUC(sens, spec)

Arguments

sens

a numerical vector of sensitivity values within the range of (0, 1).

spec

a numerical vector of specificity values within the range of (0, 1).

Value

AUC as a numerical scalar.

Note

This function sorts sens and 1-spec in an increasing order. A 0 and 1 will be added to the two ends of the sorted vectors. The Area Under the Curve (AUC) is obtained by trapezoidal integration of the area under the piecewise linear curve obtained by connecting points in sens and 1-spec. .

Examples

1
2
3
4
5
sens <- c(0.99, 0.97, 0.83, 0.60, 0.40, 0.20) ;
spec <- c(0.50, 0.61, 0.80, 0.90, 0.95, 0.98) ;
plot( 1-spec, sens, type = "l" ) ;
points(1-spec, sens) ;
calc.AUC( sens, spec ) ;

tdROC documentation built on May 2, 2019, 8:31 a.m.

Related to calc.AUC in tdROC...