ppv | R Documentation |
Calculate the Positive Predictive Value for predicted probabilities against a binary outcome.
ppv(preds, obs, thresh = 0.5)
preds |
A vector of predicted probabilities. |
obs |
A vector containing the observed binary outcomes (0 or 1). |
thresh |
The threshold at or above which a prediction is considered positive. Default = 0.5. |
The positive predictive value is the probability of a true outcome conditional on a true prediction.
# Generate some predictions
predictions <- runif(1000)
# Generate some binary outcomes
observations <- sample(0:1, size = 1000, replace = TRUE)
# Calculate the Sensitivity
ppv(predictions, observations)
# And at a different threshold
ppv(predictions, observations, thresh = 0.8)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.