Report

Help us improve this tool

Bayes Theorem Calculator

Calculate posterior probability P(A|B) using Bayes' Theorem given prior probabilities P(A), P(B|A), and P(B|~A) with step-by-step formula breakdown.

O M T

Understanding Bayes' Theorem and Posterior Probability

Bayes' Theorem is a fundamental principle of probability theory and statistics named after Thomas Bayes. It describes how to update the probability of a hypothesis ($A$) when new evidence ($B$) becomes available.

Bayes' Theorem Formula

The mathematical formula for Bayes' Theorem is expressed as:

$$P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B)}$$

Expanding the total probability $P(B)$ via the law of total probability:

$$P(B) = P(B|A) \cdot P(A) + P(B|\neg A) \cdot P(\neg A)$$

Key terms in the equation:

  • $P(A|B)$ (Posterior Probability): The probability of hypothesis $A$ given evidence $B$.
  • $P(A)$ (Prior Probability): The initial probability of $A$ before seeing evidence $B$.
  • $P(B|A)$ (Likelihood): The probability of seeing evidence $B$ given hypothesis $A$ is true.
  • $P(B|\neg A)$ (False Positive Rate): The probability of seeing evidence $B$ when hypothesis $A$ is false.

Practical Example: Medical Test Interpretation

Suppose a medical condition affects 1% of a population ($P(A) = 0.01$). A screening test has 95% sensitivity ($P(B|A) = 0.95$) and a 5% false positive rate ($P(B|\neg A) = 0.05$). If a patient tests positive ($B$), the actual posterior probability that they have the condition is:

$$P(A|B) = \frac{0.95 \times 0.01}{(0.95 \times 0.01) + (0.05 \times 0.99)} = \frac{0.0095}{0.0095 + 0.0495} \approx 16.10\%$$

For other statistical probability calculations, check our Probability Calculator and Odds Probability Calculator.

Frequently Asked Questions

What is the difference between prior and posterior probability?

Prior probability P(A) is your belief in an event before observing new evidence, whereas posterior probability P(A|B) is the revised probability after taking the new evidence into account.

What is a false positive rate P(B|~A)?

The false positive rate represents the probability that the evidence or test result B occurs even when the underlying condition or event A is not true.

Why is Bayes' Theorem important in machine learning?

Bayes' Theorem forms the foundation of Bayesian inference, Naive Bayes classifiers, spam filtering, and risk assessment models.