TruePositiveRate: True positive rate of a set of binary predictions against...

View source: R/Utilities.R

TruePositiveRateR Documentation

True positive rate of a set of binary predictions against their trues

Description

Let the set of predictions be described by a logical vector 'pred', and let the corresponding trues by described in a logical vector 'true' of the same length. Then, the true positive rate is given by the expression: sum(pred & true)/sum(true). The false positive rate is given by the expression: sum(pred & !true)/sum(!true). If these expressions do not give a finite number, NA_real_ is returned.

Usage

TruePositiveRate(pred, true)

FalsePositiveRate(pred, true)

Arguments

pred, true

vectors of the same positive length that can be converted to logical.

Value

a double between 0 and 1 or NA_real_ if the result is not a finite number.

Examples

TruePositiveRate(c(1,0,1,1), c(1,1,0,1))
TruePositiveRate(c(0,0,0,0), c(1,1,0,1))
TruePositiveRate(c(1,1,1,1), c(1,1,0,1))
FalsePositiveRate(c(1,0,1,1), c(1,1,0,1))
FalsePositiveRate(c(0,0,0,0), c(1,1,0,1))
FalsePositiveRate(c(1,1,1,1), c(1,1,0,1))
TruePositiveRate(c(1,0,1,1), c(0,0,0,0))
FalsePositiveRate(c(1,0,1,1), c(1,1,1,1))

venelin/PCMBase documentation built on March 14, 2024, 8:24 p.m.