# Bayes Law with Multiple Events

I am having trouble answering this question on Conditional Probabilities

Here is my current understanding:

1. Conditional Probability Law: $$P(A|B) = \frac{P(A \cap B)}{P(B)}$$

Here is a visualization I thought to illustrate this concept (Python):

1. Bayes Law: The Conditional Law of Probability can be re-written in a different perspective using Bayes Law

$$P(A|B) = \frac{P(A \cap B)}{P(B)} \quad \text{thus} \quad P(A \cap B) = P(A|B)P(B)$$ $$P(B|A) = \frac{P(B \cap A)}{P(A)} \quad \text{thus} \quad P(B \cap A) = P(B|A)P(A)$$ $$\text{since} \quad P(A \cap B) = P(B \cap A) \quad \text{thus} \quad P(A|B)P(B) = P(B|A)P(A)$$ $$\text{Bayes Law: } P(A|B) = \frac{P(A)P(B|A)}{P(B)} \quad \text{or} \quad P(B|A) = \frac{P(B)P(A|B)}{P(A)}$$

1. Intro question: Suppose there is a rare disease that has a 1% prevalence rate. A test has a 99% chance of correctly detecting the disease for a person who has the disease and a 99% chance of rejecting a person who does not have the disease. Suppose a person tests positive - what is the probability that this person has the disease?

Answer: If prevalence rate is P(D), the probability of positive test given the disease P(T|D), and the probability of negative test given you don't have the disease P(T'|D'). The probability that a person has the disease given they tested positive, P(D|T), can be calculated using Bayes' theorem:

$$P(D|T) = \frac{P(T|D) \cdot P(D)}{P(T)}$$

The trick here is to recognize that $$P(T)$$ can happen two ways: The test can be positive give you have the disease $$P(T|D)$$ and the the test can be positive when you don't have the disease $$P(T|D')$$. Therefore, $$P(T) = P(T|D) + P(T|D')$$ :

$$P(D|T) = \frac{P(T|D) \cdot P(D)}{P(T|D) + P(T|D')}$$ $$P(D|T)= \frac{0.99 \cdot 0.01}{0.99 \cdot 0.01 + 0.01 \cdot 0.99}$$ $$= \frac{0.0099}{0.0099 + 0.0099}$$ $$= \frac{0.0099}{0.0198}$$ $$= 0.5$$

Remember $$P(T|D')$$ is the probability of a positive test given you don't have the disease - this is told to you in the question indirectly : 100% -1% = 99%

1. Here is where I struggle: Suppose a person has 2 positive test results, what is the probability that this person actually has the disease? Here is my logic:

$$P(D | T1,T2) = \frac{P(D) * P(T1,T2 | D)}{P(T1,T2)} = \frac{P(D) * P(T2 | D) * P(T1 | D)}{P(T2,T1)} = \frac{P(D) * P(T2 | D) * P(T1 | D)}{P(D)P(T2 | D)P(T1 | D) + P(D')P(T2 | D')P(T1 | D')}$$

This relies on the fact that test 1 and test 2 are independent so $$P(T1,T2 | D) = P(T2 | D) * P(T1 | D)$$. Also, $$P(T1,T2)$$ needs to be decomposed into parts - two positive tests can happen either when a person has a disease or a person does not have the disease.

My confusion comes from the fact that this is a famous medical question where the two medical test scenario is said to use the single medical test scenario as a Bayesian update - but in the way I have done this, the two medical test scenario does not require any information from the single medical test scenario. Is it all correct?

• Is this a question from the NCERT textbook? Commented Dec 23, 2023 at 4:55
• this is from a youtube video I saw on math paradoxes Commented Dec 23, 2023 at 4:56
• Oh, I see. I'd love to help you, but I'm not at home right now. I'll post a comprehensive explanation later. Commented Dec 23, 2023 at 4:56

You are correct. In shortened form Bayes Theorem can be written:

$$\mathbb{P}(A|B) = \frac{\mathbb{P}(B|A)\mathbb{P}(A)}{\mathbb{P}( B|A)\mathbb{P}(A) + \mathbb{P}(B|A^c) \mathbb{P}(A^c)}$$ Where $$A^c$$ is the event requivalent to not $$A$$ ($$A' = A^c$$). Your example has similar numbers to make the calculation easy which makes it a bit confusing, but it is overall correct math (although your second step is written out wrong you may want to check that but right after you have it correct). But what happens for more than one event? Let $$B = C \cap D$$. Then we get: $$\mathbb{P}(A|C \cap D) = \frac{\mathbb{P}(C \cap D|A)\mathbb{P}(A)}{\mathbb{P}( C \cap D|A)\mathbb{P}(A) + \mathbb{P}(C \cap D|A^c) \mathbb{P}(A^c)}$$Quick note since again my notation is different than yours: $$\mathbb{P}(C \cap D) = \mathbb{P}(C,D)$$. And, if we assume that $$C$$ and $$D$$ are independent (like the first and second test results would be): $$\mathbb{P}(A|C \cap D) = \frac{\mathbb{P}(C|A)\mathbb{P}(D|A)\mathbb{P}(A)}{\mathbb{P}(C|A)\mathbb{P}(D|A)\mathbb{P}(A) + \mathbb{P}(C|A^c)\mathbb{P}(D|A^C) \mathbb{P}(A^c)}$$ The way you have the work written is a bit odd however; I suggest that when you know you are going to use Bayes's theorem, just write out Bayes's theorem without the work to get there, and since $$\mathbb{P}(T_1, T_2) = \mathbb{P}(T_1, T_2| D)\mathbb{P}(D) + \mathbb{P}(T_1,T_2 | D^c)\mathbb{P}(D^c)$$ is correct but very trivial. It's by no means a necessary step to show, and would just lessen the amount of work you need to write out. So you may write:

$$\mathbb{P}(T_1,T_2|D) =\frac{\mathbb{P}(T_1, T_2|D)\mathbb{P}(D)}{\mathbb{P}(T_1,T_2|D)\mathbb{P}(D) + \mathbb{P}(T_1,T_2|D^c)}$$ Which lessens the amount you have to write/type and I have to read! Now you final question:

My confusion comes from the fact that this is a famous medical question where the two medical test scenario is said to use the single medical test scenario as a Bayesian update - but in the way I have done this, the two medical test scenario does not require any information from the single medical test scenario. Is it all correct?

Does this require any information from the single medical test scenario? Yes. Because we are testing twice and getting two positives, our probability is going to vastly change, using the numbers from your examples we would get:

$$\mathbb{P}(D|T_1, T_2) = \frac{ 0.99^2 \cdot 0.01}{0.99^2 \cdot 0.01 + 0.01^2 + 0.99} = 0.99$$

Obviously, this is very different from our answer from only one test. The information that we get from our single test is present here, since $$\mathbb{P}(T_1|D)$$ or $$\mathbb{P}(T_1|D^c)$$ is present. If we don't know the result of our first test, or the first test was negative, the result is going to be very different.

If you haven't understood by now, I'll do a medical test scenario but with different numbers: Assume $$99.5$$ percent of the disease has the population, our test has a true positive rate of $$0.99$$ and a false positive rate of $$0.01$$ ($$\mathbb{P}(T|D^c) = 0.01$$). Then we have: $$\mathbb{P}(D|T_1) = \frac{\mathbb{P}(T_1|D)\mathbb{P}(D)}{\mathbb{P}(T_1|D)\mathbb{P}(D) + \mathbb{P}(T_1|D^c) \mathbb{P}(D^c)} = \frac{0.99 \cdot 0.005}{0.99 \cdot 0.005 + 0.01 \cdot 0.995} \approx 0.33$$ Or a $$1$$ in $$3$$ chance. Notice that our probability changed from the first example since the prevalence of the disease is different. Now for two:

$$\mathbb{P}(D|T_1,T_2) =\frac{\mathbb{P}(T_1, T_2|D)\mathbb{P}(D)}{\mathbb{P}(T_1,T_2|D)\mathbb{P}(D) + \mathbb{P}(T_1,T_2|D^c)} = \frac{0.99^2 \cdot 0.005}{0.99^2 \cdot 0.005 + 0.01^2 \cdot 0.995} \approx 0.98$$ Or $$98$$%. I've skipped a step at the end, but we worked it out above so I hope you understand. If you have any questions feel free to ask.

If you would like more reading, I believe MIT OpenCourseWare has a few introduction to probability classes with slideshows on this.