calc.ing

Bayes Theorem

Conditional probability update.

%
%
%

What does Bayes Theorem mean?

Bayes' Theorem is a fundamental rule of probability that describes how to update your beliefs about an event after observing new evidence. It calculates the posterior probability — the revised probability of a hypothesis being true given observed data. The theorem is widely used in medicine, machine learning, spam filtering, and decision-making under uncertainty.

How to calculate Bayes Theorem

Bayes' Theorem is calculated with the formula: P(A|B) = P(B|A) * P(A) / P(B). For example, suppose a medical test for a rare disease has a 90% true positive rate (P(B|A) = 90%), the disease affects 1% of the population (P(A) = 1%), and 5% of all people test positive overall (P(B) = 5%). Then P(A|B) = 0.90 * 0.01 / 0.05 = 0.18, or 18%. Despite the accurate test, there is only an 18% chance you actually have the disease if you test positive — because the disease is so rare.

FAQ

When the prior probability (base rate) of an event is very low, even a highly accurate test produces many false positives relative to true positives. This is known as the base rate fallacy. Bayes' Theorem accounts for this by weighing the test accuracy against how common the condition actually is.

The likelihood ratio is P(B|A) / P(B). It measures how much more likely the evidence is if the hypothesis is true versus overall. A likelihood ratio greater than 1 means the evidence supports the hypothesis; less than 1 means it weakens it. The higher the ratio, the stronger the evidence.

Yes. The generalized form applies to multiple hypotheses. You compute P(A_i|B) = P(B|A_i) * P(A_i) / P(B) for each hypothesis A_i, where P(B) is the sum of P(B|A_i) * P(A_i) across all hypotheses. This calculator covers the two-hypothesis (binary) case.

You can calculate P(B) using the law of total probability: P(B) = P(B|A) * P(A) + P(B|not A) * P(not A). For example, if the true positive rate is 90%, the false positive rate is 5%, and the disease prevalence is 1%, then P(B) = 0.90 * 0.01 + 0.05 * 0.99 = 0.009 + 0.0495 = 0.0585, or about 5.85%.

Bayes' Theorem is used in medical diagnosis (interpreting test results), email spam filtering (classifying messages), machine learning (Naive Bayes classifiers), search engines (ranking relevance), criminal justice (evaluating forensic evidence), and financial risk assessment.

Related calculators