Bayesian Posterior Probability Calculator

Bayes’ theorem turns a starting belief and the reliability of a piece of evidence into an updated probability. It explains why a positive result from a good test can still mean a low chance when the condition is rare.

Also called: Bayes’ theorem calculator · Bayes rule calculator

  • Last updated
  • Formula tested against reference values

Your numbers

How likely the hypothesis is before seeing the evidence (for a test: how common the condition is).

For a test, its sensitivity (true positive rate).

For a test, its false positive rate (1 − specificity).

Result

Posterior P(H | evidence)
—

Calculating…

Overall chance of the evidence P(E)
—
P(H | evidence not seen)
—
Likelihood ratio P(E | H) ÷ P(E | not H)
—
Prior odds
—
Posterior odds
—

How to use this calculator

  1. Enter or choose prior probability P(H).
  2. Enter or choose p(evidence | H true).
  3. Enter or choose p(evidence | H false).
  4. The posterior P(H | evidence) updates as you type. Use Copy result or Share to keep it.

Method

P(H | E) = P(E | H)·P(H) ÷ P(E), where P(E) = P(E | H)·P(H) + P(E | ¬H)·(1 − P(H)); posterior odds = prior odds × likelihood ratio

P(H)
prior probability of the hypothesis
P(E | H)
chance of the evidence if H is true
P(E | ¬H)
chance of the evidence if H is false
P(H | E)
posterior probability

Worked example

  1. P(E) = 0.80 × 0.01 + 0.096 × 0.99 = 0.008 + 0.09504 = 0.10304.
  2. P(H | E) = 0.008 ÷ 0.10304 = 0.07764, about 7.8%.
  3. If the test is negative: P(H | not E) = 0.20 × 0.01 ÷ 0.89696 = 0.22%.

With a 1% base rate, a test with 80% sensitivity and a 9.6% false positive rate gives only a 7.8% chance of the condition after a positive result.

What the result means

The posterior depends heavily on the prior. When the hypothesis starts out rare, most positive evidence comes from false positives, so the posterior stays low even for a fairly accurate test. A likelihood ratio above 1 means the evidence supports H; how far it moves you depends on where you started.

Assumptions and limits

  • There are two mutually exclusive possibilities: H is true or it is false.
  • The probabilities you enter apply to the situation at hand (for a test, to people like the one tested).
  • For more than two competing hypotheses, or repeated pieces of evidence that are not independent, the calculation needs to be extended.
  • This is a probability calculation, not a diagnosis.

Questions

Why is the posterior so low when the test is 80% accurate?

Because 99% of people tested do not have the condition, and 9.6% of them test positive. That is about 95 false positives per 1,000 people versus 8 true positives.

Can I chain results?

Yes. Use the posterior from one independent piece of evidence as the prior for the next.