Learn R Programming

fmsb (version 0.6.3)

roc: Calculate Receiver Operating Characteristic (ROC) curve

Description

Calculate Receiver Operating Characteristic (ROC) curve's each performance set of [sensitivity, 1-specificity], each distance of the performance from the worst performance [0, 1], and each piece of area under the curve, for each cutoff point, as list. Fittest cut off is suggested as the set of [sensitivity, 1-specificity] which gives the longest distance from [0, 1] (though it's not common). If option maxdist=FALSE is given, the distances are calculated from the best performance [1, 0] and fittest cut off is the set of [sensitivity, 1-specificity] which gives minimum distance from best performance.

Usage

roc(values, iscase, maxdist=TRUE)

Arguments

values

A numeric vector of measured values.

iscase

A logical (or 0/1) vector of diagnostics. Negative result must be given by FALSE or 0.

maxdist

A logical value to specify the method of distance calculation to seek the best cutoff. Default TRUE.

Value

cutoff

The numeric vector of cutoff points, which are composed of the all unique values among the given measurements and the maximum cutoff is maximum measurement plus 1. Therefore, the minimum cutoff gives [1, 1] and the maximum cutoff gives [0, 0] as the performance set of [sensitivity, 1-specificity], respectively.

sens

The numeric vector of sensitivities for all cutoff points.

falsepos

The numeric vector of 1-specificities (false positiveness) for all cutoff points.

distance

The numeric vector of distance between actual performance set and the worst performance.

aucpiece

The numeric vector of the pieces of areas under the curve.

maxdist

Same as the given argument maxdist.

See Also

ROC

Examples

Run this code
# NOT RUN {
 scores <- c(15, 20, 19, 28, 26, 17, 13, 22, 23, 24)
 diagno <- c(0, 0, 0, 1, 1, 1, 0, 1, 1, 1)
 res <- roc(scores, diagno)
 print(res)
 plot(res)
# }

Run the code above in your browser using DataLab