sensitivity: Sensitivity

Description Usage Arguments Details Value Examples

View source: R/sensitivity.R

Description

Measure sensitivity of a classifier

Usage

1
sensitivity(threshold, responses, predictions, na.rm = FALSE)

Arguments

threshold

a numeric threshold. Values of predictions greater than this threshold will be predicted to be positive

responses

a vector of binary responses (TRUE/FALSE or 1/0) to be predicted

predictions

a vector of numeric predicted values that can be converted to binary predictions using threshold

na.rm

if TRUE, NA values will be removed before computing sensitivity

Details

This function calculates sensitivity given predictions, responses, and a prediction threshold.

sensitivity = TP / P

where TP is the number of True Positives (correctly identified positive responses) and P is the total number of positive responses.

Value

the sensitivity when prediction responses using predictions at the given threshold

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# observed (binary) values
resp <- c(1, 0, 1, 1, 0, 1,
        0, 1, 1, 1, 0, 0)

# predicted values
pred <- c(0.75, 0.7, 0.63,
          0.7, 0.4, 0.52,
         0.6, 0.9, 0.3, 0.2,
         0.4, 0.3)

sensitivity(threshold = 0.5, responses = resp, predictions = pred)

wgaul/wgutil documentation built on June 1, 2020, 3:39 a.m.