Calculators
Bayes Theorem Calculator
Calculate posterior probability using Bayes theorem with medical test mode (prevalence, sensitivity, specificity) or general mode (prior, likelihood, false positive rate) locally in your browser.
Update probabilities with new evidence.
Bayes theorem updates the probability of a hypothesis given new evidence: P(H|E) = P(E|H) × P(H) ÷ P(E). In medical mode, enter the prevalence (pre-test probability), sensitivity (true positive rate), and specificity (true negative rate) to get the positive predictive value (PPV), negative predictive value (NPV), and likelihood ratios. In general mode, enter the prior probability P(H), likelihood P(E|H), and false positive rate P(E|¬H) to get the posterior probability P(H|E), marginal probability P(E), and likelihood ratios. All probabilities are decimals from 0 to 1. For example, with prevalence 0.01, sensitivity 0.95, specificity 0.90, the PPV is about 0.0876 (8.76%): a positive test raises the probability of disease from 1% to 8.76%, but it remains low because the disease is rare. All calculations stay in your browser.
Frequently Asked Questions
Everything you need to know about this tool, how it works, and privacy.
What is Bayes theorem?
Bayes theorem updates the probability of a hypothesis H given evidence E: P(H|E) = P(E|H) × P(H) ÷ P(E). The marginal probability P(E) = P(E|H) × P(H) + P(E|¬H) × P(¬H). It combines prior belief with new evidence to give a posterior belief.
What is the difference between the two modes?
Medical mode uses prevalence (pre-test probability), sensitivity (true positive rate), and specificity (true negative rate) — the standard parameters for diagnostic tests. General mode uses prior probability P(H), likelihood P(E|H), and false positive rate P(E|¬H) — the direct parameters of Bayes theorem. Both compute the same posterior probability.
How do I interpret the positive predictive value (PPV)?
PPV is the probability that the hypothesis is true given a positive test result. With prevalence 0.01, sensitivity 0.95, specificity 0.90, PPV ≈ 0.0876 (8.76%): a positive test raises the probability from 1% to 8.76%, but it remains low because the condition is rare. PPV increases with higher prevalence.
What are likelihood ratios?
LR+ = sensitivity / (1 − specificity) = P(E|H) / P(E|¬H) tells how much a positive result increases the odds. LR− = (1 − sensitivity) / specificity = P(¬E|H) / P(¬E|¬H) tells how much a negative result decreases the odds. LR+ > 10 and LR− < 0.1 are considered strong evidence.
Are my probability values uploaded?
No. All calculations run locally in your browser. CodeASystem does not upload or store the values you enter.