sens_spec_plus: Compute Sensitivity, Specificity and a Few Friends

View source: R/helper_functions.R

sens_spec_plusR Documentation

Compute Sensitivity, Specificity and a Few Friends

Description

sens_spec_plus computes sensitivity, specificity and a few friends from a gold standard and testing results. sens_spec_plus is a convenience wrapper for epiR::epi.tests.

Usage

sens_spec_plus(
  test = NULL,
  gold = NULL,
  method = c("exact", "jeffreys", "wilson", "agresti", "clopper-pearson"),
  conf_level = 0.95
)

Arguments

test

numeric vector containing testing results, coded as 0 for negative and 1 for positive.

gold

numeric vector containing the gold standard, coded as 0 for negative and 1 for positive.

method

type of uncertainty interval ("exact", "wilson", "agresti", "clopper-pearson" or"jeffreys"). Default: "exact".

conf_level

confidence level, a numeric value between 0 and 1. Default: 0.95.

Value

sens_spec_plus returns a list containing components table and ests:

table

a 2 x 2 table which is the anti-transpose of the result produced by base::table(gold, test).

ests

a dataframe containing the apparent (test-based) and true positive proportions, sensitivity, specificity, positive predictive value (PPV), negative predictive value (NPV), and the lower and upper uncertainty limits for each.

See Also

epi.tests

Examples

Gold <- rbinom(20, 1, 0.50)
Test <- Gold; Test[c(3, 5, 9, 12, 16)] <- 1 - Test[c(3, 5, 9, 12, 16)]
sens_spec_plus(test = Test, gold = Gold, method = "jeffreys")


sgutreuter/screenr documentation built on Nov. 20, 2022, 2:41 a.m.