Calculator Inputs
Formula Used
P(A|B) = [P(B|A) × P(A)] / P(B)
P(B) = [P(B|A) × P(A)] + [P(B|Not A) × P(Not A)]
P(Not A) = 1 − P(A)
P(Not B|A) = 1 − P(B|A)
P(Not B|Not A) = 1 − P(B|Not A)
P(A|Not B) = [P(Not B|A) × P(A)] / P(Not B)
Posterior Odds = Prior Odds × Bayes Factor
Bayes Factor = P(B|A) / P(B|Not A)
The calculator applies these relationships to compute posteriors, complements, joint probabilities, evidence probabilities, expected counts, and sensitivity curves from one consistent Bayesian setup.
How to Use This Calculator
- Enter a label for the main event A and evidence B.
- Choose whether you want to work in decimals or percentages.
- Provide the prior probability P(A).
- Enter the likelihood P(B|A), which measures evidence when A is true.
- Enter the false positive probability P(B|Not A).
- Optionally add a known marginal evidence probability P(B) for comparison.
- Set a sample size to translate probabilities into expected counts.
- Pick precision and graph points, then press Calculate Bayes Rule.
- Review the summary cards, detailed probability table, expected counts, and sensitivity graph.
- Use the CSV and PDF buttons to export the results section.
Example Data Table
| Scenario | Input Value | Interpretation |
|---|---|---|
| P(Disease) | 0.0100 | 1% prior chance of disease. |
| P(Positive Test|Disease) | 0.9500 | 95% sensitivity. |
| P(Positive Test|Not Disease) | 0.0800 | 8% false positive rate. |
| P(Positive Test) | 0.0887 | Overall chance of a positive result. |
| P(Disease|Positive Test) | 0.1071 | Posterior probability becomes 10.71%. |
| Expected True Positives in 10,000 | 95.00 | Positive tests from actual disease cases. |
| Expected False Positives in 10,000 | 792.00 | Positive tests from healthy cases. |
FAQs
1. What does Bayes Rule calculate?
It updates the probability of an event after new evidence appears. The calculator combines prior belief, likelihood, and false positive rate to produce a posterior probability.
2. What is the difference between prior and posterior?
The prior is your starting belief before seeing evidence. The posterior is the revised belief after the evidence has been included through Bayes Rule.
3. Why do false positives matter so much?
Even strong tests can mislead when false positives are common or the event is rare. Bayes Rule corrects for this by weighting evidence against the base rate.
4. Can I enter percentages instead of decimals?
Yes. Switch the input mode to percent and enter values from 0 to 100. The calculator converts them internally and still displays precise decimal and percentage results.
5. What does the sensitivity graph show?
It shows how the posterior changes as the prior changes while the likelihood and false positive rate stay fixed. This helps you test assumptions visually.
6. What are expected counts used for?
Expected counts convert probabilities into intuitive sample outcomes such as true positives, false positives, false negatives, and true negatives for the sample size you choose.
7. Should I enter a known P(B) value?
Only when you already know the marginal evidence probability from another reliable source. The calculator will compare that value against the probability derived from total probability.
8. Is this calculator useful outside medical testing?
Yes. Bayes Rule is widely used in fraud detection, machine learning, diagnostics, reliability analysis, forecasting, quality control, and many other decision problems.