The Bayes' Theorem Calculator computes posterior probability from prior, likelihood, and false positive rate. The foundational tool for medical screening interpretation, spam filtering, and any probabilistic reasoning where base rate neglect leads to consistently wrong intuitive conclusions.
0.153846
0.0585
15.3846
%
0.009
0.0495
15.3846
x
0.153846
0.0585
15.3846
%
0.009
0.0495
15.3846
x
A positive mammogram result sounds alarming — but what is the actual probability that the patient has cancer? Without applying Bayes' Theorem to account for the test's false positive rate and the disease's base rate, the intuitive interpretation leads to dramatic overestimation of post-test disease probability. The calculator for Bayes' Theorem takes the three key probabilities and computes the correct posterior probability — the result that determines whether a positive screening result warrants urgent intervention or routine follow-up.
The posterior probability P(A|B) — the probability of event A given that B has occurred — is:
P(A|B) = P(B|A) × P(A) / P(B)
where P(B) = P(B|A) × P(A) + P(B|not A) × P(not A) is the total probability of observing B. The three inputs:
Use this online calculator for any prior, likelihood, and false positive rate combination. The Bayesian updating calculator applies sequential updating when multiple pieces of evidence are observed.
The classic illustration of Bayes' Theorem is population-level disease screening. Breast cancer mammography screening example:
P(cancer|positive) = (0.85 × 0.01) / (0.85 × 0.01 + 0.10 × 0.99) = 0.0085 / (0.0085 + 0.099) = 0.0085 / 0.1075 = 7.9%. A positive mammogram in routine screening corresponds to less than 8% probability of actual cancer — which is why follow-up imaging (not immediate biopsy) is the standard response. This non-intuitive result arises because the 1% prevalence means there are 99 cancer-free women for every 1 with cancer, and 10% of those 99 generate false positives that overwhelm the true positives from the 1 actual case.
Bayesian reasoning appears across virtually every probabilistic inference problem:
The conditional probability calculator and probability calculators provide related probability calculation tools.
Base rate neglect — ignoring the prior probability P(A) when interpreting evidence — is one of the most documented cognitive biases in human judgment. Kahneman and Tversky's research found that people typically estimate posterior probabilities close to the likelihood P(B|A) alone, ignoring the prior. This leads to consistent overestimation of rare event probabilities (a rare disease feels more likely after a positive test than the calculation warrants) and underestimation of common event probabilities when evidence is weak. Explicitly working through Bayes' Theorem prevents this bias by forcing attention to the prior probability before incorporating new evidence.
Bayes' theorem is expressed as:
$$P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B)}$$
Where the total probability of B is expanded using the law of total probability:
$$P(B) = P(B|A) \cdot P(A) + P(B|\neg A) \cdot P(\neg A)$$
So the full formula becomes:
$$P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B|A) \cdot P(A) + P(B|\neg A) \cdot (1 - P(A))}$$
Where:
The denominator P(B) serves as a normalizing constant ensuring the posterior is a valid probability. The ratio P(B|A)/P(B) is called the Bayes factor, which quantifies how much the evidence B shifts your belief in A. A Bayes factor greater than 1 increases the probability of A; less than 1 decreases it.
Bayes' theorem is particularly powerful when the prior probability is very different from what intuition might suggest. The classic example is medical screening: even with a highly accurate test, a positive result for a rare disease may still have a low posterior probability because the prior (disease prevalence) is so small.
The posterior P(A|B) tells you the updated probability of hypothesis A after considering evidence B. Compare it to the prior P(A) to understand the impact of the evidence. A large increase from prior to posterior indicates strong evidence. A small increase means the evidence is weak or the false positive rate is high relative to the likelihood.
Key insight: when P(A) is very small (rare events), even tests with high sensitivity and low false positive rates can produce posteriors well below 50%. This is why screening programs for rare diseases often require confirmatory testing.
Inputs
Results
With 1% disease prevalence, 95% test sensitivity, and 5% false positive rate: P(Disease|Positive) = (0.95 × 0.01) / (0.95 × 0.01 + 0.05 × 0.99) = 0.0095/0.059 ≈ 16.1%. Despite a positive test result, there's only a 16% chance of actually having the disease — highlighting why Bayesian reasoning is essential in medicine.
Inputs
Results
30% of emails are spam. The word 'free' appears in 80% of spam and 10% of legitimate email. P(Spam|'free') = (0.8 × 0.3)/(0.8 × 0.3 + 0.1 × 0.7) = 0.24/0.31 ≈ 77.4%. Seeing the word 'free' raises the spam probability from 30% to 77%.
The prior probability P(A) represents your initial belief about the likelihood of hypothesis A before considering the current evidence. It can come from historical data, previous studies, expert opinion, or domain knowledge. In medical testing, the prior is often the disease prevalence in the relevant population. In Bayesian statistics, the choice of prior is explicit and can be updated as more data is collected.
In Bayesian terminology, probability refers to P(A) — the chance of a hypothesis being true. Likelihood refers to P(B|A) — how probable the observed evidence is under a given hypothesis. The likelihood is not a probability of the hypothesis; it is a probability of the data. The likelihood function is central to both Bayesian and frequentist statistics, but its interpretation differs between the two frameworks.
Bayes' theorem reveals that a positive test result does not mean you definitely have the disease. The positive predictive value (posterior probability) depends critically on disease prevalence. For rare diseases (low prior), even excellent tests produce many false positives relative to true positives. A test with 99% sensitivity and 99% specificity applied to a disease with 0.1% prevalence yields a posterior of only about 9%. This is why screening programs require cost-benefit analysis and confirmatory testing protocols.
The Bayes factor is the ratio P(B|A)/P(B|¬A), representing how many times more likely the evidence is under hypothesis A compared to not-A. A Bayes factor of 10 means the evidence is 10 times more probable if A is true. It converts the prior odds P(A)/P(¬A) to posterior odds: posterior odds = Bayes factor × prior odds. Bayes factors above 10 are considered strong evidence, above 100 decisive evidence.
Yes. Bayesian updating is inherently iterative. The posterior from one piece of evidence becomes the prior for the next. After observing evidence B₁, compute P(A|B₁). Then when B₂ is observed, use P(A|B₁) as the new prior to compute P(A|B₁,B₂). This sequential updating is mathematically equivalent to processing all evidence simultaneously and is the foundation of online learning algorithms and adaptive systems.
If P(A) = 0, the posterior P(A|B) is always 0 regardless of evidence — once you are certain A is impossible, no amount of data changes that. Similarly, P(A) = 1 always gives a posterior of 1. These are called dogmatic priors. In practice, Bayesian analysts avoid priors of exactly 0 or 1 because they prevent any learning from data. Instead, use very small or very large values (like 0.001 or 0.999) to represent near-certainty while remaining open to updating.
How helpful was this calculator?
5.0/5 (1 rating)