Bayes theorem calculator for two hypotheses
Update a prior probability using the evidence likelihood under a hypothesis and its complement with Bayes’ theorem.
How to use this calculator
Update a prior probability using the evidence likelihood under a hypothesis and its complement with Bayes’ theorem.
- Enter Prior P(H), Evidence likelihood P(E|H), P(E|not H). Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
How the Bayes theorem calculator for two hypotheses works
Update a prior probability using the evidence likelihood under a hypothesis and its complement with Bayes’ theorem.
Inputs and units
- Prior P(H): Prior probability P(H), entered as a decimal.
- Evidence likelihood P(E|H): Evidence likelihood under H, not the posterior being sought.
- P(E|not H): Evidence likelihood under not H; for a diagnostic analogy this is the false-positive probability, not specificity.
Formula and method
P(H|E) = P(E|H)P(H) / [P(E|H)P(H) + P(E|not H)(1−P(H))]
Worked example
Prior 0.01, evidence likelihood 0.95 under H, and 0.05 under not H give 0.0095/(0.0095+0.0495) = 0.161016949, or about 16.10%.
Interpreting the result
The posterior combines the base rate and evidence. A strong evidence likelihood can still yield a modest posterior when the prior is small.
Assumptions and limits
The two hypotheses must be exhaustive complements. Inputs are decimal probabilities from zero to one. Evidence with zero total probability leaves the posterior undefined; the calculator replaces the numeric result with an explanation.
Sources and method
- Explains independence, conditional probabilities, and Bayes updating. OpenStax Principles of Data Science: probability theory
Frequently asked questions
Should I enter specificity in the third field?
No. Enter the probability of the evidence when H is false. If evidence is a positive test, this is one minus specificity.
Why can the posterior be far below 95% in the example?
The 95% input is a likelihood, not a posterior. The low prior and evidence among the much larger complement group affect the result.
How do I use the Bayes theorem calculator for two hypotheses?
Enter Prior P(H), Evidence likelihood P(E|H), P(E|not H). Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Bayes theorem calculator for two hypotheses?
Prior 0.01, evidence likelihood 0.95 under H, and 0.05 under not H give 0.0095/(0.0095+0.0495) = 0.161016949, or about 16.10%.
What does the Bayes theorem calculator for two hypotheses calculate?
Update a prior probability using the evidence likelihood under a hypothesis and its complement with Bayes’ theorem.
See the calculation methodology.