Bayes Theorem Calculator

Compute posterior probability P(H|E).

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Enter the prior P(H), the hit rate P(E | H) and the false-alarm rate P(E | not H). A 1% prior with a test that is 95% sensitive and 5% false-positive gives a posterior of 0.161017, only 16%.

How to use

1
Step 1
Enter the prior probability P(H).
2
Step 2
Enter P(E | H), the chance of the evidence if H is true.
3
Step 3
Enter P(E | not H), the chance of the evidence if H is false.
4
Step 4
Press Calculate.

How it works

Bayes' theorem reverses a conditional probability: P(H | E) = P(E | H) P(H) ÷ P(E). The surprise in the first example is that a positive result from a good test is still mostly false when the condition is rare: 0.95 × 0.01 = 0.0095 true positives against 0.05 × 0.99 = 0.0495 false positives.

P(H | E) = P(E | H)P(H) ÷ [P(E | H)P(H) + P(E | ¬H)(1 − P(H))]

Worked example

Screening for a rare condition

Input
P(H) = 0.01, P(E|H) = 0.95, P(E|not H) = 0.05
Output
0.161017
Walkthrough
0.0095 ÷ (0.0095 + 0.0495) = 0.0095 ÷ 0.059 = 0.161017.

Limitations

  • All three inputs must be probabilities between 0 and 1.
  • Assumes a single yes/no hypothesis.

Questions

What is P(H | E) for a 1% prior, 95% hit rate and 5% false-positive rate?
0.161017, about 16.1%.
What is the posterior for a 30% prior, 80% hit rate and 10% false-alarm rate?
0.774194.
When does the evidence change nothing?
When P(E | H) equals P(E | not H); the posterior then equals the prior, for example 0.5 with a 0.5 prior.

Features

  • Posterior from three inputs
  • Instant
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Finding mean, median, and mode

    Khan Academy

    Core descriptive stats for mean/median/mode tools.

    Watch on YouTube
  • Average or Central Tendency

    Khan Academy

    When to prefer mean vs median in tool output.

    Watch on YouTube
  • Math is Fun

    Math is Fun

    Clear explainers that pair well with calculator-style tools.

  • Geometry Index

    Math is Fun

    Shape and formula index for geometry calculators.