Learn R Programming

plotROC (version 1.3.3)

calculate_roc: Calculate the Empirical ROC curve

Description

Calculate the empirical ROC curve estimate given labels and predictions

Usage

calculate_roc(M, D, ci = FALSE, alpha = 0.05)

Arguments

M
continuous marker values or predictions of class labels
D
class labels, must be coded as 0 and 1. If not numeric with 0/1, then plotROC assumes the first level in sort order is healthy status, with a warning.
ci
Logical, if true, will calculate exact joint confidence regions for the TPF and FPF
alpha
Confidence level, ignored if ci = FALSE

Value

  • A dataframe containing cutoffs, estimated true and false positive fractions, and confidence intervals if ci = TRUE.

Details

Confidence intervals for TPF and FPF are calculated using the exact method of Clopper and Pearson (1934) each at the level 1 - sqrt(1 - alpha). Based on result 2.4 from Pepe (2003), the cross-product of these intervals yields a 1 - alpha

Examples

Run this code
D.ex <- rbinom(100, 1, .5)
calculate_roc(rnorm(100, mean = D.ex), D.ex)
calculate_roc(rnorm(100, mean = D.ex), D.ex, ci = TRUE)

Run the code above in your browser using DataLab