Bayes' Theorem Calculator
Enter P(A), P(B) and P(B|A) to compute the posterior probability P(A|B). Essential for medical testing, spam filtering and decision analysis.
Input Data
Results
At a glance:Bayes' Theorem relates conditional probabilities: P(A|B) = P(B|A) × P(A) ÷ P(B). From the conditional probability of B given A and the marginals of A and B, it computes the conditional probability of A given B. Intuition often fails here — the classic example is disease screening: even with 95% sensitivity, if prevalence is 1%, a positive test's true posterior probability is far below 95% because P(B) includes many false positives.
Formula
Bayes' theorem:
P(A|B) = [P(B|A) × P(A)] ÷ P(B)
where P(A) is the prior, P(B|A) is the likelihood, P(A|B) is the posterior.
Example: P(A)=1%, P(B)=2%, P(B|A)=95% → P(A|B) = 0.95×0.01÷0.02 = 47.5%
$$P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B)}$$How to Use
- Enter the prior P(A) (e.g. prevalence).
- Enter P(B) (e.g. positive-test rate).
- Enter the likelihood P(B|A) (e.g. sensitivity).
- The tool computes the posterior P(A|B).
- P(B) cannot be 0; otherwise the posterior is undefined.
Case Studies
Disease screening
Prevalence 1%, sensitivity 95%, overall positive rate 2% → posterior = 47.5%, far below the 95% sensitivity.
FAQ
Why is a positive test not proof of the disease?
The posterior also depends on the prior prevalence and false-positive rate; with low prevalence even a sensitive test yields many false positives.
Related Tools
References
Content review: Calculatorism Science Team. Results are for reference only; please refer to the relevant authorities for the official figures.