Bayes test calculator

Understand predictive values using prevalence, sensitivity, specificity and expected frequencies.

About this tool

Prevalence is the share of the modeled population with a condition before testing. Sensitivity is the chance of a positive test given the condition. Specificity is the chance of a negative test without it. These three percentages must refer to a relevant population and the same test.

The table uses a fixed reference group of 10,000 people. With probabilities p, se and sp, true positives TP = 10,000p·se, false negatives FN = 10,000p(1−se), false positives FP = 10,000(1−p)(1−sp), and true negatives TN = 10,000(1−p)sp. These are expected counts, not a simulated or measured sample; fractions are allowed. Calculations use unrounded values.

PPV = TP/(TP+FP) is the chance of the condition given a positive result. NPV = TN/(TN+FN) is the chance of no condition given a negative result. They are not the same as sensitivity or specificity. If no positive or no negative results can occur, the corresponding conditional probability is undefined, not zero. Extremely tiny values that underflow arithmetic are rejected.

At 1% prevalence, 99% sensitivity and 95% specificity, 100 of 10,000 people have the condition: 99 test positive and one negative. Of the other 9,900, 495 test positive and 9,405 negative. Therefore, only 99 of 594 positive results are true positives: PPV ≈ 16.67%. The prevalence examples keep test sensitivity and specificity fixed; the specificity example removes false positives.

Definitions follow the CDC/NIOSH archive, Weissman and Lewis (2000), Table 1. The presentation in frequencies is informed by Hoffrage and colleagues (2015). Examples are hypothetical. Population-level predictive values are not an individual diagnosis; no uncertainty in inputs, clinical history or repeated-test dependence is modeled.

Calculate explicitly. Edits or example changes clear old results; Reset retains inputs. Valid inputs remain when returning through app navigation.