PPV {measures} | R Documentation |
Positive predictive value
Description
Defined as: tp / (tp + fp). Also called precision. If the denominator is 0, PPV is set to be either 1 or 0 depending on whether the highest probability prediction is positive (1) or negative (0).
Usage
PPV(truth, response, positive, probabilities = NULL)
Arguments
truth |
vector of true values |
response |
vector of predicted values |
positive |
positive class |
probabilities |
[numeric] vector of predicted probabilities |
Examples
n = 20
set.seed(125)
truth = as.factor(sample(c(1,0), n, replace = TRUE))
probabilities = runif(n)
response = as.factor(as.numeric(probabilities > 0.5))
positive = 1
PPV(truth, response, positive, probabilities = NULL)
[Package measures version 0.3 Index]