
Predictive values at specified disease prevalences
Source:R/obs-predictive-values.R
epi_predictive_values.RdEstimates sensitivity and specificity from the supplied test/reference data, then uses Bayes' rule to calculate positive and negative predictive values at each specified target prevalence. Both diseased and non-diseased subjects are required in the reference data. The method assumes that sensitivity and specificity transport unchanged to the target setting and that the supplied prevalence is appropriate. Spectrum effects, imperfect reference standards, verification bias and uncertainty in prevalence or test accuracy are not addressed. Intervals are not calculated.
Value
A tibble with each target prevalence, sample sensitivity and
specificity, and implied positive and negative predictive values. A zero
probability of a positive or negative test yields the corresponding NA.
Examples
d <- data.frame(test = c(1, 1, 0, 0), truth = c(1, 0, 1, 0))
epi_predictive_values(d, test, truth, prevalence = c(.01, .1, .5))
#> # A tibble: 3 × 5
#> prevalence sensitivity specificity ppv npv
#> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 0.01 0.5 0.5 0.01 0.99
#> 2 0.1 0.5 0.5 0.1 0.9
#> 3 0.5 0.5 0.5 0.5 0.5