Calculator
Choose a mode, enter percentages from 0 to 100, then submit. The result appears above this form.
Example data table
| Scenario | Prior P(A) | P(B|A) | P(B|¬A) | Posterior P(A|B) |
|---|---|---|---|---|
| Medical screening | 5.00% | 95.00% | 8.00% | 38.46% |
| Spam filter alert | 30.00% | 90.00% | 15.00% | 72.00% |
| Quality defect flag | 2.00% | 92.00% | 3.00% | 38.49% |
| Fraud review trigger | 1.00% | 85.00% | 2.00% | 30.04% |
Formula used
General Bayes theorem
P(A|B) = [P(B|A) × P(A)] / P(B)
P(B) = [P(B|A) × P(A)] + [P(B|¬A) × P(¬A)]
Reverse Bayes setup
P(B|¬A) = [P(B) - P(B|A) × P(A)] / P(¬A)
This mode checks whether the implied complement likelihood is mathematically valid.
Diagnostic interpretation
PPV = [Sensitivity × Prevalence] / [[Sensitivity × Prevalence] + [(1 - Specificity) × (1 - Prevalence)]]
NPV = [Specificity × (1 - Prevalence)] / [[Specificity × (1 - Prevalence)] + [(1 - Sensitivity) × Prevalence]]
How to use this calculator
- Pick the calculation mode that matches the information you already know.
- Enter probabilities as percentages between 0 and 100.
- Use direct mode for priors and conditional evidence rates.
- Use reverse mode when the overall evidence probability is known.
- Use diagnostic mode for prevalence, sensitivity, and specificity.
- Set a population size to see expected cohort counts.
- Press Calculate to show the result above the form.
- Use the chart and exports to compare or share outcomes.
FAQs
1. What does Bayes theorem calculate?
Bayes theorem updates an initial belief after new evidence appears. The result is the posterior probability, which shows how likely the event is once the evidence has been considered.
2. When should I use direct mode?
Use direct mode when you know the prior probability, the evidence likelihood if the event is true, and the evidence likelihood if the event is false.
3. What is the false evidence rate?
It is the probability of observing the same evidence even when the event did not occur. Lower values usually create stronger posterior updates.
4. Why can a strong test still give a modest posterior?
A rare event can remain unlikely even after positive evidence. Very low prevalence or prior probability often limits the final posterior unless the evidence is exceptionally discriminating.
5. What does diagnostic mode show?
Diagnostic mode converts prevalence, sensitivity, and specificity into predictive values and expected counts. It is useful for screening tests, defect detection, and alerting systems.
6. What does the chart represent?
The chart shows how the posterior or predictive values change as the prior or prevalence changes, while your other likelihood settings stay fixed.
7. Should I enter decimals or percentages?
Enter percentages. For example, type 5 for 5%, 80 for 80%, and 0.5 only if you actually mean 0.5%.
8. Are the cohort counts real observations?
No. They are model-based expected counts derived from the probabilities you entered. They help visualize outcomes in a sample population of your chosen size.