GintiCalcEvery calculation

BayesLab

Bayes' Theorem Calculator

P(A|B) = P(B|A) · P(A) / P(B).

Bayes theorem: posterior probability after evidence

Given a prior P(A), the likelihood P(B|A) and the false-positive rate P(B|not A), Bayes gives the updated probability of A once B is observed.

Prior P(A)P(B|A)P(B|not A)Evidence P(B)Posterior P(A|B)
0.010.990.050.05940.1667
0.020.950.100.11700.1624
0.100.900.200.27000.3333
0.300.700.400.49000.4286
0.500.800.300.55000.7273

The first row is the classic medical testing result and the reason Bayes is worth learning: a test that is 99% accurate on people who have a condition still leaves you only 16.67% likely to have it after testing positive, because the condition affects just 1% of people and the 5% false-positive rate applies to the other 99%. The base rate dominates. Compare it with row five, where a 50% prior and a weaker test produce a 72.73% posterior. The lesson is that a positive result from a good test on a rare condition is usually still a false positive, which is why screening programmes retest.

What is Bayes' theorem?

Bayes' theorem calculates how likely a hypothesis is after observing new evidence. The formula is P(A|B) = P(B|A) × P(A) / P(B), where P(A) is the prior (your belief before evidence), P(B|A) is the likelihood (probability of seeing this evidence if A is true), and P(B) is the total probability of the evidence.

Medical test example: why false positives dominate

A disease affects 1 in 1,000 people. A test is 99% accurate (catches 99% of true cases, 1% false positive rate). You test positive — what's the chance you have it? Bayes says: 0.99 × 0.001 / (0.99 × 0.001 + 0.01 × 0.999) = 9.0%. Despite a 99% accurate test, there's only a 9% chance you're actually sick — because the false positives from 999 healthy people overwhelm the true positives from 1 sick person.

Bayes' theorem in everyday decisions

Spam filters use it (probability an email is spam given it contains certain words). Insurance companies use it for risk assessment. Courts should use it when evaluating DNA evidence. Anytime you update a belief based on new information, you're implicitly doing Bayesian reasoning.

Prior, likelihood, and posterior explained

Prior P(A): your initial estimate before seeing evidence. Likelihood P(B|A): how expected the evidence would be if your hypothesis is true. Posterior P(A|B): your updated belief after seeing the evidence. The posterior becomes the prior for the next round of evidence — this is how beliefs update iteratively.

Frequently asked questions

What is Bayes' theorem used for?

Bayes' theorem updates the probability of a hypothesis when you receive new evidence. It's used in medical diagnosis (interpreting test results), spam filtering, machine learning, forensic DNA analysis, weather forecasting, and any situation where you need to revise a probability estimate based on new data.

What do prior, likelihood, and posterior mean?

Prior P(A) is the initial probability before new evidence. Likelihood P(B|A) is the probability of observing the evidence if the hypothesis is true. Posterior P(A|B) is the updated probability after considering the evidence. The formula combines all three: posterior = (likelihood × prior) / evidence.

Why do accurate medical tests give so many false positives?

When a disease is rare (say 0.1% prevalence), even a 99% accurate test produces many false positives. Out of 1,000 people, 1 has the disease (test catches it) but 10 healthy people also test positive (1% of 999). So most positive results are false — the rarity of the disease overwhelms the test's accuracy.

How is Bayes' theorem different from regular probability?

Regular (frequentist) probability treats events as fixed — a coin is 50/50 period. Bayesian probability treats probabilities as beliefs that update with evidence. This is more natural for one-time events: 'given this evidence, how likely is the suspect guilty?' is Bayesian, not frequentist.

Related Math calculators

You might also like

Last updated: September 6, 2026