F1 Score Calculator

Turn a reported F1 score into PPV and NPV, where it was measured or in your own population. F1 blends PPV with sensitivity and never counts true negatives, so one F1 fits many tests; the charts show how much room that leaves.

F1 = 2 × PPV × Sensitivity / (PPV + Sensitivity) = 2 TP / (2 TP + FP + FN)

The harmonic mean of PPV (precision) and sensitivity (recall). TP, FP and FN are true positives, false positives and false negatives; true negatives never enter the formula.

Input Parameters

Harmonic mean of PPV (precision) and sensitivity (recall)
Percent of positive cases in the test set. AI test sets are often enriched well above clinical prevalence.
Operating point
Percent of people with the disease where the test will be used, e.g. 3 for 3%. Sensitivity and specificity carry over; PPV, NPV and F1 are recalculated.

Calculated Statistics

Enter an F1 score and prevalence

Positive Predictive Value (PPV) --
Negative Predictive Value (NPV) --
Sensitivity (recall)Implied by F1 and the operating point --
SpecificityImplied by F1 and the operating point --
Likelihood Ratio (+) --
Likelihood Ratio (-) --

PPV and NPV across prevalence

Sensitivity and specificity, worked out from F1 where it was measured, are held fixed while prevalence changes. F1 itself falls with prevalence, so a test set enriched with disease flatters it.

Enter an F1 score and prevalence to draw the curves.

PPV and NPV by F1 score and prevalence

Each point is a test whose F1 (vertical axis) was measured in the test set, then used at the prevalence on the horizontal axis.

PPV

NPV

Operating points with the same F1

Every sensitivity in the unshaded range pairs with a PPV that gives the same F1. Click the chart to use a different operating point.

Enter an F1 score and prevalence to draw the trade-off.

2×2 Contingency Table (per 10,000 people)

Disease PresentDisease AbsentTotal
Test Positive------
Test Negative------
Total----10,000

Report summary

Plain-language summary of the inputs, the assumption and the results, ready to paste into a note or a manuscript.

Enter an F1 score and prevalence to build the summary.

Key Formulas

F1 = 2 × PPV × Sens / (PPV + Sens) = 2TP / (2TP + FP + FN)
Per person in the test set (prevalence p₀, sensitivity S): TP = p₀S, FN = p₀(1 − S), FP = p₀[(2 − F1)S − F1] / F1, TN = 1 − p₀ − FP
Specificity = TN / (1 − p₀)
Possible sensitivities: F1 / (2 − F1) ≤ S ≤ min(1, F1 / [p₀(2 − F1)])
Balanced (FP = FN): Sens = PPV = F1, Specificity = NPV = 1 − p₀(1 − F1) / (1 − p₀)
At prevalence p: PPV = Sens·p / [Sens·p + (1 − Spec)(1 − p)], NPV = Spec(1 − p) / [Spec(1 − p) + (1 − Sens)p]
F1 at prevalence p = 2·Sens·p / [Sens·p + p + (1 − Spec)(1 − p)]; calling everyone positive gives F1 = 2p / (1 + p)

References

  • van Rijsbergen CJ. Information Retrieval. 2nd ed. London: Butterworths; 1979.
  • Hand D, Christen P. A note on using the F-measure for evaluating record linkage algorithms. Stat Comput. 2018;28(3):539-547. doi:10.1007/s11222-017-9746-6
  • Chicco D, Jurman G. The advantages of the Matthews correlation coefficient (MCC) over F1 score and accuracy in binary classification evaluation. BMC Genomics. 2020;21:6. doi:10.1186/s12864-019-6413-7

Assumes the test's sensitivity and specificity are the same in your population as in the test set, which fails when case mix or disease spectrum differs. Results are point estimates without confidence intervals; for those, use the 2×2 counts in the Diagnostic Calculator.