Type: Package
Title: Recover Diagnostic Test Accuracy Counts from Reported Accuracy Measures
Version: 0.1.0
Date: 2026-01-09
Description: Implements a system of linear equations to recover unreported diagnostic test accuracy cell counts from commonly reported measures such as sensitivity, specificity, predictive values, prevalence, and sample size. The package is intended for applied researchers who require complete 2x2 table counts for downstream analyses.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.3
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0)
Config/testthat/edition: 3
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2026-01-09 20:13:49 UTC; 12896
Author: Conrad Kabali [aut, cre]
Maintainer: Conrad Kabali <conrad.kabali@utoronto.ca>
Repository: CRAN
Date/Publication: 2026-01-14 18:00:09 UTC

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
)

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.

Value

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

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

# 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
)