04 // Interactive Formula Compendium // STATISTICSP(A | B) = [ P(B | A) · P(A) ] / P(B)
Bayes' Theorem Conditional Probability Formula
Bayes' theorem P(A|B) = P(B|A)P(A) / [P(B|A)P(A) + P(B|¬A)P(¬A)] computes the exact posterior probability of hypothesis A given observed evidence B, sensitivity P(B|A), and base rate P(A).
Formula Reference
Main Formula
P(A | B) = [ P(B | A) · P(A) ] / P(B)
Rearranged Forms
P(B) = P(B|A)·P(A) + P(B|¬A)·(1 − P(A))
Posterior Odds = Likelihood Ratio × Prior Odds
Variables & Units
| Symbol | Name | Unit |
|---|---|---|
| post | Posterior Probability P(A|B) | probability (0–1) |
| prior | Prior Base Rate P(A) | 0–1 |
| sens | Sensitivity P(B|A) | 0–1 |
| fpr | False Positive Rate P(B|¬A) | 0–1 |
Inputs & Parameters
[0–1]
[0–1]
[0–1]
Calculated Result (Posterior Probability P(A|B))
post =0.166667probability (0–1)
Formula Notes & Background
- By definition of conditional probability, P(A ∩ B) = P(A|B)P(B) = P(B|A)P(A); dividing by marginal P(B) expanded via the Law of Total Probability yields Bayes' rule.
- Demonstrates the base-rate fallacy: when prevalence P(A) is rare, even a 99% sensitive / 95% specific test yields a modest single-test positive predictive value.
Step-by-Step Examples
#1: Medical screening for a 1% prevalence condition (P(A)=0.01) using a test with 99% sensitivity and 5% false-positive rate (95% specificity).
P(A) = 0.01P(B|A) = 0.99P(B|¬A) = 0.05
P(A|+) = (0.99 × 0.01) / (0.0099 + 0.05 × 0.99) = 0.0099 / 0.0594
→ P(A|+) = 0.1667 (16.67% Positive Predictive Value)
#2: Running a second independent confirmatory test with the same 99% sensitivity / 5% FPR using 16.67% as the updated prior.
Updated Prior = 0.1667
P(A|++) = (0.99 × 0.1667) / (0.1650 + 0.05 × 0.8333) = 0.1650 / 0.2067
→ P(A|++) = 0.7984 (79.84% after two positives)
Was this tool helpful?
Frequently Asked Questions
What is the difference between sensitivity and specificity?+
Sensitivity is the true-positive rate P(+|Disease), while specificity is the true-negative rate P(−|Healthy) = 1 − False Positive Rate.
How does sequential Bayesian updating work?+
Today's posterior probability P(A|B₁) becomes tomorrow's prior before incorporating new independent evidence B₂.
What is the Bayes factor (likelihood ratio)?+
LR⁺ = P(B|A) / P(B|¬A) = Sensitivity / (1 − Specificity), which directly multiplies prior odds into posterior odds.