Key Facts
- Category
- Math, Date & Finance
- Input Types
- number, select
- Output Type
- json
- Sample Coverage
- 1
- API Ready
- Yes
Overview
The Bayes Theorem Calculator allows you to determine the posterior probability of an event by updating its prior probability with new evidence. By inputting the base rate, likelihood (true positive rate), and false-positive rate, you can quickly evaluate the real-world accuracy of diagnostic tests, spam filters, and risk assessments without manually calculating complex conditional probability formulas.
When to Use
- •Evaluating the actual probability of having a condition after receiving a positive medical test result.
- •Updating risk models or fraud detection algorithms when new behavioral evidence is observed.
- •Solving statistics and probability problems that require applying Bayes' theorem to conditional probabilities.
How It Works
- •Enter the prior probability (base rate) of the event occurring before any evidence is known.
- •Input the likelihood (true positive rate) and the false-positive rate of the test or evidence.
- •Select your preferred input scale (percentages or proportions) and set the desired decimal precision.
- •The calculator applies Bayes' theorem to output the updated posterior probability as both a proportion and a percentage.
Use Cases
Examples
1. Calculating Disease Probability After a Positive Test
Medical Student- Background
- A student is analyzing a rare disease that affects 1% of the population. A test for the disease has a 99% true positive rate but a 5% false-positive rate.
- Problem
- Determine the actual probability that a patient has the disease if they test positive.
- How to Use
- Set Prior P(A) to 1, Likelihood to 99, and False Positive to 5. Keep the input scale as Percent.
- Example Config
-
Prior: 1, Likelihood: 99, False Positive: 5, Scale: percent - Outcome
- The calculator reveals a posterior probability of 16.6667%, demonstrating the base rate fallacy where a positive test does not guarantee the presence of the disease.
2. Updating Spam Probability
Data Scientist- Background
- An email filter needs to classify incoming messages. Historically, 20% of all emails are spam. A specific keyword appears in 80% of spam emails, but also in 10% of legitimate emails.
- Problem
- Calculate the probability that an email is spam if it contains this keyword.
- How to Use
- Enter 20 for Prior P(A), 80 for Likelihood, and 10 for False Positive Rate.
- Example Config
-
Prior: 20, Likelihood: 80, False Positive: 10, Scale: percent - Outcome
- The posterior probability updates to 66.6667%, indicating the email is significantly more likely to be spam when the keyword is present.
Try with Samples
math-&-numbersFAQ
What is prior probability?
Prior probability, or base rate, is the initial estimated likelihood of an event occurring before any new evidence or test results are considered.
What does likelihood mean in this calculator?
Likelihood represents the true positive rate, or the probability that the evidence (such as a positive test result) appears when the event is actually true.
Why is the posterior probability often lower than expected?
If the prior probability (base rate) is very low, even a highly accurate test with a small false-positive rate will yield a surprisingly low posterior probability. This statistical phenomenon is known as the base rate fallacy.
Can I input values as decimals instead of percentages?
Yes, you can change the Input Scale setting from 'Percent' to 'Proportion' to enter decimal values like 0.01 instead of 1%.
What is the false-positive rate?
The false-positive rate is the probability that the evidence or test result is positive even when the underlying event is false.