Bayes Theorem Calculator

This calculator uses Bayes' Theorem to update the probability of a hypothesis based on new evidence. It's widely used in medical testing, machine learning, and statistical inference.

What is Bayes' Theorem?

Bayes' Theorem describes the probability of an event based on prior knowledge of conditions that might be related to the event. It allows us to update our beliefs about the probability of a hypothesis as we gather more evidence.

The Formula

P(H|E) = P(E|H) × P(H) / P(E)

Where:

  • P(H|E) - Posterior probability: the probability of hypothesis H given evidence E
  • P(E|H) - Likelihood: the probability of observing evidence E if hypothesis H is true
  • P(H) - Prior probability: the initial probability of hypothesis H before seeing the evidence
  • P(E) - Marginal probability: the total probability of observing evidence E

Medical Testing Example

A common application is interpreting medical test results. Even with a highly accurate test, if the condition is rare, a positive test result doesn't guarantee the disease is present.

For example, if a disease affects 1% of the population, and a test is 95% accurate:

  • Prior probability (prevalence): 1% or 0.01
  • True positive rate (sensitivity): 95% or 0.95
  • False positive rate: 5% or 0.05
  • After a positive test, the actual probability of having the disease is only about 16%!

Key Concepts

  • Prior Probability: Your initial belief before seeing evidence
  • Likelihood Ratio: How much the evidence supports the hypothesis
  • Posterior Probability: Your updated belief after considering the evidence
  • Odds: The ratio of the probability of an event occurring to it not occurring