I have generated some scores to help predict whether or not something is yes (1) or no (0), let\'s say the data consists of:
scores = c(10:20)
response = c(
I will give an answer based around the pROC package*. It is possible to obtain similar results using the ROCR package as well.
You want to use the coords function, which can compute several common statistics at some given thresholds. For instance, in order to get the PPV at all thresholds, you can do the following:
library(pROC)
r <- roc(response = response, predictor = scores)
coordinates <- coords(r, x = "all", input = "threshold", ret = c("threshold", "ppv"))
You can then plot those values:
plot(t(coordinates))
Replace "all"
by the thresholds of interest:
coordinates <- coords(r, x = c(13, 14, 15, 16, 17), input = "threshold", ret = c("threshold", "ppv"))
* Disclaimer: I am the author of the pROC package.