ppv: Positive Predictive Value

Description Usage Arguments Details Value Examples

View source: R/ppv.R

Description

Computes the Positive Predictive Value (PPV) of a given test/prediction against a gold standard/ground truth.

Usage

1
ppv(pred, truth)

Arguments

pred

vector of 1s and 0s or True and False representing predictions

truth

vector of 1s and 0s or True and False representing gold standards or ground truths

Details

Takes in vectors representing a prediction and a ground truth. Vectors may be either logical using T/F or numeric using 1 and 0s. Vectors must be of the same length

Value

Positive predictive value (PPV) computed as True Pos / (True Pos + False Pos)

Examples

1
2
3
4
5
6
7
pred1 <- c(1,1,0,1,1,0,0)
truth1 < c(1,0,0,1,1,0,1)
ppv(pred1,truth1)

pred2 <- c(T,T,F,T,T,F,F)
truth2 <- c(T,F,F,T,T,F,T)
ppv(pred2, truth2)

frankchien/bmi585flc documentation built on Dec. 20, 2021, 8:51 a.m.