Bayes' theorem & base rates 2.0
About this app
Rebuild 2.0 (preview): Bayes' theorem with prevalence, sensitivity and specificity, prior and posterior on an absolute scale.
The statistics
Sensitivity P(+|D) says how often a test detects people who are ill. Someone who tests positive wants to know something else: P(D|+), how likely they are to be ill. Bayes’ theorem links the two, and the difference comes from the base rate, the prevalence. In odds form it is especially simple: posterior odds = prior odds · LR+, with the likelihood ratio LR+ = sensitivity / (1 − specificity). Each further independent positive test multiplies the odds by LR+ again.
What you see
In the scene every dot is a person: colour shows whether they are really ill or healthy, a filled dot a positive test and a ring a negative one. A four-step sequence runs from population through testing and sorting to a second test. On the right, prior and posterior sit on a fixed 0 to 100 % scale, and a dashed line marks the sensitivity that is often confused with P(D|+). A tree diagram and the calculation in odds complete the picture. Examples include mammography screening and rapid tests with and without symptoms.
Things to try
Load the mammography example with 1 % prevalence, 90 % sensitivity and a 9 % false-positive rate from Gigerenzer et al. and step through it. After sorting you can see that only a small share of those who tested positive are ill. Add a second test: the posterior from the first test becomes the new prior and rises sharply. Compare the rapid-test examples with and without symptoms (data from Dinnes et al., Cochrane 2021): at 0.5 % instead of 20 % prevalence a positive result says far less.
Frequently asked questions
- How likely is breast cancer after a positive mammogram?
- It depends strongly on prevalence. With the frequently cited figures for women around 50 in screening (prevalence 1 %, sensitivity 90 %, false-positive rate 9 %), only about one in ten women with a positive result actually has cancer. The reason is that there are far more healthy women, a small share of whom test false positive.
- What is the positive likelihood ratio LR+?
- The positive likelihood ratio is sensitivity divided by the false-positive rate, LR+ = sensitivity / (1 − specificity). It states by what factor a positive test raises the odds of disease. In the odds form of Bayes’ theorem, posterior odds = prior odds · LR+.
- Why does a second test help?
- After a positive first test the probability of disease is higher than the original prevalence. That value becomes the prior for the second test. If the second test is also positive and independent of the first, the posterior rises considerably.
- What is new in version 2.0 of the Bayes app?
- Version 2.0 is a rebuild (preview): every dot is a person, and a four-step sequence sorts those who test positive and allows a second test. Prior and posterior sit on a fixed 0 to 100 % scale, with a tree diagram, odds calculation with LR+ and examples on mammography and rapid tests.
Subject: Statistics
More from Statistics
- Anscombe's quartet
- Bias-variance / overfitting
- Box plot workshop
- Geometric mean
- Law of large numbers
- Histogram workshop
- Hypothesis test & p-value
- Confidence interval
A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps