# Finding the probability that someone has the disease, given they test positive on two tests

This question is from the textbook "Introduction to Probability - Blitzstein & Hwang."

I was studying for a class when I came across an example problem that I solved, but got a slightly different result than the textbook. Here's the problem in question, paraphrased:

"Fred tests for a disease which afflicts 1% of the population. The test's accuracy is deemed 95%. He tests positive for the first test, but decides to get tested for a second time. Unfortunately, Fred also tests positive for the second test as well. Find the probability that Fred has the disease, given the evidence."

$$\$$

My approach is as follows:

Let $$D$$ be the event that Fred has the disease, $$T_1$$ be the event that the first test result is positive, and $$T_2$$ be the event that the second test is also positive. We want to find $$P(D\ |\ T_1,\ T_2)$$.

We are also able to condition on $$T_1$$ (i.e. the event that the first test result is positive). This would give us:

$$P(D\ |\ T_1,\ T_2) = \frac{P(T_2\ |\ D,\ T_1)P(D\ |\ T_1)}{P(T_2\ |\ T_1)}$$

From my calculations:

$$P(T_2\ |\ D,\ T_1)\ =\ P(T_2\ |\ D)\ =\ 0.95$$ $$P(D\ |\ T_1)\ \approx\ 0.16$$ $$P(T_2\ |\ T_1)\ =\ \frac{P(T_1 ,\ T_2)}{P(T_1)}\ =\ \frac{P(T_1,\ T_2,\ D)\ +\ P(T_1,\ T_2,\ D^c)}{P(T_1,\ D)\ +\ P(T_1,\ D^c)}\ =\ \frac{0.0115}{0.059}\ \approx\ 0.19$$ $$\$$ $$P(D\ |\ T_1,\ T_2)\ =\ \frac{0.95\ \times\ 0.16}{0.19}\ =\ 0.8$$

Therefore, I concluded that there is an 80% chance that Fred has the disease, given that both the first and second test results are positive.

$$\$$

The problem is that the textbook has taken a different approach of using the odds form of Bayes' rule, which resulted in a conclusion slightly different from mine (0.78), and I'm having trouble understanding how that conclusion came to be.

$$\$$

Textbook approach is as follows:

$$\frac{P(D\ |\ T_1,\ T_2)}{P(D^c\ |\ T_1,\ T_2)}\ =\ \frac{P(D)}{P(D^c)}\ \times\ \frac{P(T_1,\ T_2\ |\ D)}{P(T_1,\ T_2\ |\ D^c)}$$

$$=\ \frac{1}{99}\ \times\ \frac{0.95^2}{0.05^2}\ =\ \frac{361}{99}\ \approx\ 3.646$$

which "corresponds to a probability of 0.78."

$$\$$

Here are the specific questions I have:

1. Is my approach wrong? A 0.02 difference is a pretty big difference.

2. How did the author derive the equation:

$$P(D\ |\ T_1,\ T_2)\ =\ P(D)P(T_1,\ T_2\ |\ D)$$

1. What does the author mean when he/she says "3.646 corresponds to a probability of 0.78?"

$$\$$

Any feedback is appreciated. Thank you!

• A very similar question was asked on this site about 6 years ago. Here is the link to it: math.stackexchange.com/questions/198677/… Commented Oct 7, 2018 at 0:25
• Thanks for the feedback! I actually read that question while looking for other answers. It didn't address the questions that I had, though, which led me to ask my own.
– Sean
Commented Oct 7, 2018 at 2:26

The conditional probability (or Bayes's rule) must be: $$P(D\ |\ T_1\cap T_2) = \frac{P(D\cap T_1\cap T_2)}{P(T_1\ \color{red}{\cap}\ T_2)}=\frac{P(D)\cdot P(T_1|D)\cdot P(T_2|D\cap T_1)}{P(T_1\ \cap\ T_2)}=\\ \frac{0.01\cdot 0.95^2}{0.01\cdot 0.95^2+0.99\cdot 0.05^2}\approx 0.7848.$$

• That's nice, but that doesn't mean it applies to this question as stated. Commented Oct 6, 2018 at 16:41
• @David would you care to elaborate why you think Bayes formula does not apply to a problem so clearly amenable to conditioning... Commented Oct 7, 2018 at 2:12
• Fred is a part of the population! I think that you're right, that the question should have stated it explicitly, but mentioning a population that is completely unrelated to Fred would be a hilarious and unlikely red herring by the textbook authors. Why would they just randomly mention a population in a question about Fred, if Fred wasn't part of the population? Once you do assume Fred is part of the population, you can no longer ignore the 1% affliction rate. Commented Oct 7, 2018 at 14:03
• It was fun commenting but given the assumptions are true, I agree with these answers here. It was just an exercise on being accurate about assumptions so many next time someone posts a question like this, they will explicitly state the "missing" info. I deleted all my previous answers and comments to clean this up. Commented Oct 7, 2018 at 15:40

I have some quibbles with the way the textbook sets up its question, beginning with the assumption that both positive and negative tests each have the same likelihood to be correct, and even more so the assumption that the outcomes of two tests on the same person are independent in probability. In real life, I would want to explore both of those points further before advising Fred. But let's ignore those objections for the sake of being able to compute something based on the given information, and assume each administration of the test has the same chance to give a correct result, even when two tests are administered one after the other on the same person.

1. Is my approach wrong? A 0.02 difference is a pretty big difference.

The two methods are equivalent. The apparent discrepancy is due to roundoff.

The textbook finds an odds ratio of $$361:99,$$ which is exact (insofar as the $$1\%$$ and $$95\%$$ are exact). Since this is $$P(D) : P(D^C),$$ the probability is given by $$P(D) = \frac{P(D)}{P(D) + P(D^C)} = \frac{361}{361 + 99} \approx 0.78478,$$ which the text rounds to $$0.78.$$ (Since you asked about this as a separate part of the question, I'll explain in more detail below.)

In your approach, $$P(T_1,\ T_2,\ D)\ +\ P(T_1,\ T_2,\ D^c) = 0.0115$$ is an exact result, and so is $$P(T_1,\ D)\ +\ P(T_1,\ D^c) = 0.059,$$ but $$0.0115 / 0.059 \approx 0.19492.$$ Meanwhile, $$P(T_1 \mid D) \approx 0.16102.$$ If we carry all these digits into the computation rather than rounding off to two places immediately, we find that $$P(D\mid T_1,\ T_2) = \frac{0.95\times 0.16102}{0.19492} \approx 0.78478.$$ That is, keeping five digits we get the same answer as the textbook method (if it retained five digits), and if we round to two digits only at the end (as the textbook does) we naturally would round the same way, to $$0.78.$$

I think an argument could be made for keeping only one digit of precision in the answer (how precise is that "$$1\%$$" anyway?), in which case both answers round to $$0.8.$$

1. How did the author derive the equation ...

They didn't. Instead, the fact is that $$P(D\mid T_1,\ T_2) = \frac{P(T_1,\ T_2\mid D)P(D)}{P(T_1,\ T_2)}$$ and $$P(D^C\mid T_1,\ T_2) = \frac{P(T_1,\ T_2\mid D^C)P(D^C)}{P(T_1,\ T_2)}.$$

When you compute the ratios of the two probabilities $$\frac{P(D\mid T_1,\ T_2)}{P(D^C\mid T_1,\ T_2)},$$ you get factors of $$P(T_1,\ T_2)$$ in both the numerator and the denominator, and these factors cancel each other.

1. What does the author mean when he/she says "3.646 corresponds to a probability of 0.78?"

As I hinted above, $$3.646$$ is an odds ratio; or as I would rather say, the odds ratio is $$3.646 : 1.$$ An odds ratio of $$1:1$$ corresponds to a $$50\%$$ chance, that is, each possibility is equally likely, whereas a $$2:3$$ odds ratio describes something that happens twice for every three times it does not happen. in general, if the probability of something is $$p,$$ its odds ratio is $$p : (1 - p),$$ that is, $$\frac{p}{1 - p} : 1.$$

If we say $$p = P(D \mid T_1,\ T_2),$$ then $$P(D^C \mid T_1,\ T_2) = 1 - P(D \mid T_1,\ T_2) = 1 - p,$$ and what the textbook has computed is that $$\frac{p}{1 - p} \approx 3.646,$$ that is, on average in situations like this, when both tests come up positive, there will be $$3.646$$ cases in which the tests were both correct for each case in which both tests were incorrect. That means there are $$3.646$$ accurate positives for every $$3.646 + 1$$ times the test comes out positive both times, which gives a probability of $$\frac{3.646}{3.646 + 1} \approx 0.78.$$ The way I worked the probability, however, was to take the fraction $$\frac{p}{1 - p} = \frac{361}{99}$$ and directly extract an odds ratio of $$361:99$$ from it. This means I can wait until the very end before doing any roundoff, but in other respects it's the same as the textbook's method. In both cases the odds are simply $$kp : k(1 - p),$$ where $$k$$ is whatever constant you have to multiply each side by in order to produce either $$361:99$$ or $$3.646:1$$ from the odds ratio $$p : (1 - p).$$

• Hello. Thanks for the detailed and easy-to-understand answer! You've cleared up everything I was wondering regarding this concept. You were also correct in that my hasty rounding-off led to a different answer. The $0.19$ that I got is actually $0.194915$, which gives me a final answer of $0.779827$, which is $78\%$. Thanks for your explanation regarding the odds ratio as well, I was having some difficulty grasping what that is.
– Sean
Commented Oct 7, 2018 at 2:12
• It's just a textbook exercise problem. The percentages were given by the authors of the textbook. I wouldn't say it's "meaningless" as it provides something that students like myself can practice with. In this example it's assumed that there is only "one population" and Fred is a part of it. How is that a bad assumption?
– Sean
Commented Oct 7, 2018 at 11:49
• @David So your objections are that Fred might not be a member of "the" population, that the $1\%$ figure might be inaccurate or outdated. And indeed in real life these are things to consider, in addition to the unstated assumptions made about the frequency of errors of the test. But mathematics is never about absolute answers to real-life questions; it is about seeing what conclusions can be drawn from a given set of assumptions. To refuse to answer that question mathematically because the assumptions might be wrong, seems like a cheap excuse to me. Commented Oct 7, 2018 at 11:49
• @David The link you gave to the other question is a useful one, as the answers to that question include a real-life example that shows why we should consider it important that a disease has a very low incidence in the population. Commented Oct 7, 2018 at 11:53
• In real life, people only usually get tested for a rare disease if there is some suspicion or risk factor involved, in which case those risk factors will change your prior significantly. If Fred was only sent in to test because he had a family history of this rare disease, then your prior is going to be more than 1%. But this is a math exercise from a textbook. The point is to solve it with only what information we know, ceteris paribus. Commented Oct 7, 2018 at 13:56