Bayesian Probability Calculator
Why update probability with Bayesian evidence?
Bayesian probability updating gives a disciplined way to revise a hypothesis after observing evidence. Rather than treating an initial probability as final, Bayes’ theorem combines that starting belief with how expected the evidence would be if the hypothesis were true or false. This distinction matters in questions involving spam filters, A/B tests, fraud alerts, diagnostic tests, quality checks, and risk assessment.
This Bayesian probability calculator uses the binary form of Bayes’ theorem: the hypothesis is either true (H) or false (¬H), and the evidence E is observed. Enter the prior probability of H, the chance of E when H is true, and the chance of E when H is false. The result is the posterior probability that H is true after E has been observed.
Bayesian probability inputs in plain language
Each percentage in this Bayes’ theorem calculation describes a different conditional probability, so the direction of the condition matters.
- Prior Probability =
P(H): the probability that the hypothesis is true before the evidence is seen. For a medical condition, this is often its prevalence or base rate. - Likelihood if True =
P(E|H): the probability of observing the evidence if the hypothesis is true. If E means a positive diagnostic test, this is the sensitivity or true-positive rate. - Likelihood if False =
P(E|¬H): the probability of observing the same evidence even though the hypothesis is false. For a positive diagnostic test, this is the false-positive rate, equal to1 − specificity.
Tip: In a Bayesian test calculation, specificity is not the value for “Likelihood if False.” Convert specificity to a false-positive rate first: false positive rate = 100% − specificity.
Bayes’ theorem formula for posterior probability
This calculator obtains the posterior probability of H after evidence E with the following version of Bayes’ theorem:
Here, P(¬H) = 1 − P(H). The denominator weights the two possible states of the hypothesis and keeps the Bayesian posterior between 0 and 1. It is also the overall probability of observing the evidence:
P(E) = P(E|H)P(H) + P(E|¬H)P(¬H)
Interpreting a Bayesian posterior probability
The calculator’s output, P(H|E), answers: “Given that E occurred, how likely is H?” Compare it with the prior. A posterior above the prior means this particular evidence favors H; a posterior below the prior means the evidence weighs against H.
When reading a Bayesian posterior, avoid these two common mistakes:
- Do not equate
P(H|E)withP(E|H). A test’s sensitivity is the probability of a positive result among true cases, whereas the posterior is the probability of a true case among positive results. - Do not discard the base rate. A rare condition can retain a low posterior after a positive test when false positives are possible among a much larger group without the condition.
Worked example: Bayesian posterior for a medical test
Consider a condition affecting 1% of a population. A test is positive 95% of the time when the condition is present and is also positive 10% of the time when the condition is absent.
- Prior:
P(H) = 0.01 - Likelihood if true (sensitivity):
P(E|H) = 0.95 - Likelihood if false (false-positive rate):
P(E|¬H) = 0.10
For a positive result, the Bayesian posterior is:
P(H|E) = (0.95×0.01) / (0.95×0.01 + 0.10×0.99) ≈ 0.0876
Thus the probability that a person with a positive result has the condition is about 8.8%. Although the test is sensitive, the low prior and the 10% false-positive rate mean that positive results also arise among many people without the condition.
Bayesian posterior comparison table
These Bayes’ theorem scenarios show how changing the prior or either likelihood changes the posterior after the same type of evidence.
| Scenario | Prior P(H) | P(E|H) | P(E|¬H) | Posterior P(H|E) | What changed? |
|---|---|---|---|---|---|
| Baseline medical-test example | 1% | 95% | 10% | ≈ 8.8% | Rare condition limits posterior |
| Higher prior probability | 10% | 95% | 10% | ≈ 51.3% | Greater initial plausibility raises posterior |
| Lower false-positive rate | 1% | 95% | 1% | ≈ 49.0% | Higher specificity makes a positive result more informative |
| Less discriminating evidence | 1% | 60% | 10% | ≈ 5.7% | Evidence provides less support for H |
Bayesian probability assumptions and limitations
This Bayesian posterior calculation is intentionally limited to one binary hypothesis and one observed item of evidence.
- Binary framing: The calculation assumes H versus ¬H and E versus not E. More than two hypotheses or several possible outcomes require a broader Bayesian model.
- Correct conditional direction: The likelihood inputs must be
P(E|H)andP(E|¬H), notP(H|E). Reversing those conditionals invalidates the update. - Base-rate dependence: With a very small prior, even favorable evidence may leave a modest posterior unless the false-positive rate is extremely low.
- Consistent evidence definition: Define E consistently. If E is “test is positive,” use the positive-result likelihoods. To update on a negative result, use
P(not E|H)andP(not E|¬H)instead. - Edge cases: If
P(E)is 0—for example, when both likelihoods are 0—the posterior is undefined because the evidence is impossible under either state. Inputs of 0% or 100% are absolute assumptions and can force a posterior to 0% or 100%. - Repeated evidence: Multiple Bayesian updates require care when signals are correlated. Treating overlapping evidence as independent can double-count its informational value.
Bayesian probability reference note
Bayes’ theorem is the probability identity that links the posterior P(H|E) to the likelihood P(E|H), the false-hypothesis likelihood P(E|¬H), and the prior P(H). In diagnostic testing, sensitivity and specificity provide familiar names for the likelihood quantities used in this calculator. Before entering values, make sure all three percentages refer to the same population, time period, evidence definition, and decision threshold; otherwise the resulting posterior can be mathematically correct yet poorly matched to the question being asked.
Bayesian Signal Sweep Mini-Game
Move the decision lens to catch evidence cards whose likelihood ratio supports H and avoid cards that favor ¬H. Each caught card updates the game’s posterior as the uncertainty conditions change.
Tip: a card with higher P(E|H) than P(E|¬H) supports H. Catch those cards to raise the game posterior.
