Bayes Theorem Calculator

Calculate conditional probabilities with visual probability tree

Bayes' Theorem Calculator

Input Probabilities

P(A) - Prior Probability Initial probability before evidence 1%
P(B|A) - Likelihood Probability of evidence if A is true 90%
P(B|NOT A) - False Positive Rate Probability of evidence if A is false 5%
P(A | B) - Posterior Probability
15.4%
Probability of A after observing B
Prior vs Posterior Comparison
Prior P(A) 1%
Posterior P(A|B) 15.4%
P(NOT A | B) 84.6%
P(NOT A)
99%
P(B) Total
5.85%
Evidence Strength
15.4x
Likelihood Ratio
18.0

Interpretation

Even with a 90% sensitive test, a positive result for a 1% prevalence condition only gives a 15.4% chance of truly having it. Most positives are false positives due to the low base rate.

Probability Tree Diagram

What is Bayes' Theorem?

Bayes' Theorem is a fundamental formula in probability theory that describes how to update the probability of a hypothesis based on new evidence. It's named after Reverend Thomas Bayes, who first formulated the theorem in the 18th century.

P(A|B) = P(B|A) × P(A) / P(B)

Where:

P(A|B) is the posterior probability - the probability of A given that B is observed

P(A) is the prior probability - your initial belief about A before seeing evidence B

P(B|A) is the likelihood - the probability of observing evidence B if A is true

P(B) is the marginal probability - the total probability of observing evidence B

How to Calculate P(B)

The total probability P(B) is calculated using the law of total probability:

P(B) = P(B|A) × P(A) + P(B|NOT A) × P(NOT A)

This accounts for all possible ways that evidence B can occur - either when A is true or when A is false.

Real-World Applications

Medical Diagnosis

If a disease has 1% prevalence and a test is 90% accurate with 5% false positives, a positive test only means 15.4% chance of having the disease. This counterintuitive result shows why confirmatory testing is crucial.

Spam Filtering

Email spam filters use Bayes' Theorem to calculate the probability an email is spam based on words it contains. The filter updates its belief as it learns from more emails you mark as spam or legitimate.

Machine Learning

Naive Bayes classifiers use this theorem to predict categories. Despite the "naive" assumption of feature independence, they work remarkably well for text classification, sentiment analysis, and recommendation systems.

Privacy & Limitations

  • All calculations run entirely in your browser -- nothing is sent to any server.
  • Results are computed using standard formulas and should be verified for critical applications.

Related Tools

Related Tools

View all tools

Bayes Theorem Calculator FAQ

What is Bayes' Theorem?

Bayes' Theorem is a mathematical formula for calculating conditional probability. It allows you to update the probability of a hypothesis (A) based on new evidence (B). The formula is P(A|B) = P(B|A) × P(A) / P(B).

How do you calculate posterior probability?

Posterior probability P(A|B) is calculated by multiplying the prior probability P(A) by the likelihood P(B|A), then dividing by the total probability of the evidence P(B). This gives you the updated probability after considering new evidence.

What is the difference between prior and posterior probability?

Prior probability is your initial belief before seeing evidence. Posterior probability is your updated belief after observing evidence. Bayes' Theorem mathematically shows how to update from prior to posterior.

What are real-world applications of Bayes' Theorem?

Bayes' Theorem is used in medical diagnosis (interpreting test results), spam filtering, machine learning, weather forecasting, legal reasoning, and any field where you need to update beliefs based on new evidence.

Request a New Tool
Improve This Tool