rStats.js v1.3.0
    Preparing search index...

    Function diagnosticTests

    • Sensitivity, specificity, predictive values, likelihood ratios, accuracy, the diagnostic odds ratio and the true and apparent prevalence of a binary test, each with a confidence interval, from its 2 × 2 table. Equivalent to epiR::epi.tests() in R.

      The table is epiR's: rows test positive and negative, columns disease present and absent, [[a, b], [c, d]] with a the true positives, b the false positives, c the false negatives and d the true negatives. The proportions' intervals are those of binomCI: "exact" is Clopper-Pearson's, computed directly (epiR computes it as 1 − qbeta(...), which loses digits for small limits); "jeffreys" gives 0 and 1 at the ends, as binomCI (epiR the beta quantiles). The likelihood ratios have the log interval (Simel, Samsa and Matchar 1991) and the odds ratio Woolf's. Zero cells give infinite ratios and NaN limits, as epiR; a zero row or column total is an error.

      Parameters

      Returns DiagnosticTestsResult

      const r = diagnosticTests([[670, 202], [74, 640]]);
      r.sensitivity.estimate; // 0.9005376344086021
      r.sensitivity.confInt; // [0.8767461767957109, 0.9210922995836943]
      r.lrPos.estimate; // 3.7537261790695196
      diagnosticTests([[670, 202], [74, 640]], { prevalence: 0.1 }).ppvAtPrevalence; // 0.2943238804381625