Disease Testing Statistics Visualizations

Population Distribution

(click and drag the threshold line)

Confusion Matrix

Roc

Bayesian views:

Whole population

Sick individuals

Healthy individuals

Positive tests

Negative tests

Inputs: (raise or lower the inputs and see the resulting effects)
Healthy μ : Sick μ : Threshold :
Healthy σ : Sick σ : Balance   :
accuracy balanced
accuracy
TPR / recall
sensitivity
TNR
specificity
FPR PPV
precision
NPV

Visual Interpretations:

This interactive page illustrates a fraction of the complexity of disease testing and some of its tradeoffs, focusing on the statistical/probabilistic side.
DISCLAIMER: This is just a simplification, a toy model with a few knobs, designed by an electrical engineer with no medical background.

Populations Distribution:

Confusion Matrix:

Roc:

Bayesian views:


Visualization of Real-life Disease Testing:

Data from a published paper was recreated to illustrate a real-life situation and highlight how much two distinct tests can contrast. You can simulate the conditions reported in the journal by clicking on the "simulate" buttons below to observe the differences between the two types of tests and what occurs when specific factors are altered. The article can be found HERE and at the bottom of this section.

Statistic

Standard Q

Panbio

Current Model

Total 529 (100%) 535 (100%) 100%
True Positives 170 (32.14%) 106 (19.81%)
False Negatives 21 (3.97%) 18 (3.36%)
False Positives 1 (0.19%) 0 (0.00%)
True Negatives 337 (63,71%) 411 (76,82%)
sensitivity - SN (95%CI) 89.0% (89.0% - 93.1%) 85.5% (78.0% - 91.2%)
specificity - SP (95%CI) 99.7% (98.4% - 100%) 100% (99.1% - 100%)
positive predict value - PPV (95%CI) 99.4% (96.8% - 100%) 100% (96.6% - 100%)
negative predict value - NPV (95%CI) 94.1% (91.2% - 96.3%) 95.8% (93.4% - 97.5%)

The Panbio test can distinguish sick people from healthy people better than the Standard-Q test, assuming the model and distributions are correct. When the Panbio threshold is reduced to 50, the sensitivity and NPV increase to nearly 100%, without affecting other indicators.
Specificity appeared to be valued more than sensitivity in both tests.

*Obs: The journal measurements have been flipped because the model expects "Sick μ" to be greater than "Healthy μ" which was not the case for the article observations, but the inversion does not affect the analysis.

"Standard Q" and "Panbio" test data source: Diagnostic accuracy of two commercial SARS-CoV-2 antigen-detecting rapid tests at the point of care in community-based testing centers


Test Quality Measures

$$True\;Positives: TP$$ $$False\;Positives: FP$$ $$True\;Negatives: TN$$ $$False\;Negatives: FN$$ $$Real\;Positives: P = TP + FN $$ $$Real\;Negatives: N = TN + FP$$

Accuracy (ACC):

Accuracy is the proportion of correct predictions (both true positives and true negatives) among the total number of cases examined. \[ACC = {TP + TN \over {P+N}} = {TP + TN \over {TP+FN+TN+FP}}\]

Balanced Accuracy (bACC):

Balanced accuracy serve as an overall performance metric for a model, whether or not the true labels are balanced in the data (Changing the "Balance" input affects the accuracy but don't affect the balanced accuracy). $$bACC = {TPR + TNR \over {2}} = {1 \over 2}{\left({TP \over P}+{TN \over N}\right)} = {1 \over 2}{\left({TP \over TP + FN}+{TN \over TN + FP}\right)}$$

Sensitivity, Recall or True Positive Rate (TPR):

Sensitivity (True Positive Rate) is the probability of a positive test knowing that the individual is sick. $$TPR = {TP \over {P}} = {TP \over {TP+FN}}$$

Specificity, Selectivity or True Negative Rate (TNR):

Specificity (True Negative Rate) is the probability of a negative test knowing that the individual is healthy. $$TNR = {TN \over {N}} = {TN \over {TN+FP}}$$

False Alarm Rate or False Positive Rate (FPR):

False Positive Rate is the probability of a positive test knowing that the individual is healthy. $$FPR = {FP \over {N}} = {FP \over {FP+TN}}$$

Precision or Positive Predictive Value (PPV):

Positive Predictive Value is the probability that a positive test is correct. In other words, it is the probability of the individual being sick if the test is positive. $$PPV = {TP \over {TP+FP}}$$

Negative Predictive Value (NPV):

Negative Predictive Value is the probability that a negative test is correct. In other words, it is the probability of the individual being healthy if the test is negative. $$NPV = {TN \over {TN+FN}}$$
Reference: Wikipedia - Test Quality Measures

If you know more about the medical aspects or have real-life data from disease tests and want to enhance this page, you can DM me, submit a pull request or create an issue. Any suggestions, contributions, or comments are welcome.

Lincoln Makoto Kawakami