Bayes’ Theorem repeatedly updates the probability of a hypothesis based on new evidence, using concepts from conditional probability. This standard version of Bayes Theorem (general) uses hypothesis that has only 2 possible values—True and False.
- prior: initial or old guess
- posterior: updated probability
- likelihood function: function that models
- evidence:
, calculated by law of total probability
Rethinking in frequency format
(Book Statistical Rethinking p.50)
![]()
Pynomia - The confusion matrix
A potentially dangerous new virus, Pymonia, has been spreading throughout Minervopolis. Suppose that it has a prevalence of 3% in the population. Further, a particular diagnostic test for Pymonia has a false positive rate of 10% and a false negative rate of 1%. What, roughly, is the probability that someone who tests positive actually has Pymonia, P(Py | +)?
- P(Py) = 0.03 ⇒ P(~Py) = 0.97
- False Positive = P(+|~Py) = 0.1
- False Negative = P(-|Py) = 0.01 ⇒ True Positive = P(+|Py) = 0.99
Leprosy - 5 tests
As a physician, you examine a patient and think it is quite likely that they have leprosy. To test this, you take some skin samples and send them to the lab. If the patient has leprosy, then 70% of the time the lab says YES. If the patient does not have leprosy, then 90% of the time the lab says NO. You send 5 successive samples to the lab from the same patient. You get the results, in order: YES, NO, YES, NO, YES. Compute P(L | YNYNY) using Bayes’ Theorem.
- P(Y | L) = 0.7 (True Positive)
- P(N | L) = 0.3 (Type I error)
- P(Y | ~L) = 0.1 (False Negative)
- P(N | ~L) = 0.9 (True Negative)
Assume prior P(L) = 0.9 Likelihood: (assuming all tests are independent)
Evidence:
P(L | YNYNY) = \frac{0.9\times 0.03087}{(0.9\times 0.03087 + 0.1\times 0.00081)}= 0.997
Usage
- correct base rate fallacy: base rate is prior
- correct inverse fallacy (we usually disregard evidence)
- In science: how strong the hypothesis still holds with the presence of new evidence
- In legal evidence: the probability of the defendant being innocent given the evidence
Resources
Visualization
3Blue1Brown (2019, Dec 22). Bayes theorem, the geometry of changing beliefs. Youtube.
This is a high-quality and accessible explanation of Bayes’ Theorem and the underlying thought process associated with it. This should accompany the text above to help you complete the study guide. Can you identify the “base-rate fallacy” in connection with the “representative heuristics” in the video? Kunin, D. (n.d.). Bayesian Inference. Seeing Theory. This is an interactive visualization for Bayes’ Theorem. Read the first section on Bayes’ Theorem and note the use of “prior” and “posterior” probability. Follow the prompts to run the simulation. You should be able to describe what the probabilities P(-|H), P(+|H), P(-|D), P(+|D) mean, and what the simulation as a whole demonstrates in your own words. This will be relevant for an in-class activity in which we’ll apply Bayes’ Theorem to medical diagnostic tests (see pre-class work). Bonilla, O. (2009, May 1). Visualizing Bayes Theorem. Oscar Bonilla. This blog post gives a visually appealing explanation of Bayes’ Theorem using Venn diagrams and simple counting probabilities. Kalid. (2009). An Intuitive (and Short) Explanation of Bayes’ Theorem. BetterExplained. This blog post gives a remarkably simple and straightforward explanation of Bayes’ Theorem, with examples. People who have struggled to understand what Bayes’ Theorem means for years have been enlightened by this post.