How to use Bayes' theorem
Bayes' theorem calculates the probability of an event based on prior knowledge of conditions that might be related to the event. It applies when you know the probability of the evidence given a hypothesis, the prior probability of the hypothesis, and the overall probability of the evidence.
The setup
Identify the hypothesis and the evidence . State the known probabilities: the prior , the likelihood , and the false positive rate . If the total probability of the evidence is not given directly, calculate it using the Law of Total Probability: .
The steps
- Define events (hypothesis) and (evidence). 2. Extract , , and from the problem statement. Calculate . 3. Compute the denominator using the Law of Total Probability. 4. Apply Bayes' formula: .
Checking the result
Ensure . Verify that if the evidence is more likely under the hypothesis than in general (), then the posterior probability must be greater than the prior probability .
Common errors
Confusing the likelihood with the posterior . Failing to use the Law of Total Probability for the denominator when the total probability of the evidence is not explicitly provided.
Worked example
A disease affects 1% of a population. A test for the disease is 99% accurate (both true positive and true negative rates are 0.99). If a person tests positive, what is the probability they actually have the disease?
Let be having the disease and be testing positive. We know: , , and . Therefore, and . We need . Step 1: Calculate the denominator . Substituting the values gives . Step 2: Apply Bayes' theorem: . The probability is 50%.
FAQ
Run your own problem
References: OpenStax Introductory Statistics, Chapter 3 · Introduction to Probability by Bertsekas and Tsitsiklis, Chapter 1
See also