Bayesian Inference
A disease test can be accurate and still produce many false positives when the disease is rare. Adjust prevalence, sensitivity, and specificity to see the posterior probability update.
Even with 90% sensitivity and 90% specificity, a positive test at 1% prevalence means only about 8% of positive people actually have the disease. False positives come from the much larger healthy group.
What you are seeing
The prior is the chance of having the disease before testing.
Sensitivity is the true-positive rate; specificity is the true-negative rate. Their complements produce false negatives and false positives.
Bayes’ theorem combines the prior with the evidence to produce the posterior probability.
Why it matters
Bayesian reasoning is essential in medical testing, spam filtering, diagnostics, and decision-making under uncertainty. It exposes the base-rate fallacy.
Complexity & details
A single update costs O(1). A 1,000-person grid costs O(population) to render.
Frequently asked questions
Why can a positive test still be wrong?+
When the disease is rare, most positive results come from the much larger healthy population, even if the false-positive rate is small.
What is the difference between prior and posterior?+
The prior is the belief before seeing evidence. The posterior is the updated belief after combining the prior with the likelihood of the evidence.