Learn R Programming

diagcounts (version 0.1.0)

derive_counts: Derive Unreported Diagnostic Test Counts

Description

Recovers unreported true positive (TP), false negative (FN), false positive (FP), and true negative (TN) counts using a system of linear equations.

Usage

derive_counts(
  n,
  sensitivity = NULL,
  specificity = NULL,
  ppv = NULL,
  npv = NULL,
  prevalence = NULL,
  tol = 1e-06
)

Value

An object of class diagcounts with elements TP, FN, FP, TN.

Arguments

n

Total sample size.

sensitivity

Test sensitivity.

specificity

Test specificity.

ppv

Positive predictive value.

npv

Negative predictive value.

prevalence

Pretest probability.

tol

Numerical tolerance for validation.

References

Xie X, Wang M, Antony J, Vandersluis S, Kabali CB (2025). System of Linear Equations to Derive Unreported Test Accuracy Counts. Statistics in Medicine. https://doi.org/10.1002/sim.70336

Examples

Run this code
# Recover unreported diagnostic counts from published accuracy measures
derive_counts(
n = 105,
sensitivity = 0.6,
specificity = 0.893,
prevalence = 0.733
)

# Recover counts using predictive values
derive_counts(
  n = 160,
  sensitivity = 0.75,
  ppv = 0.75,
  npv = 0.75
)

Run the code above in your browser using DataLab