# Probability of having a disease - Bayes' Theorem problem

3% of the country has a disorder. However, the health institute recently developed a test for the disorder that has a 97% "true positive" rate (the probability that a person will test positive given that they have the disorder) and a 2% false positive rate (the probability that a person will test positive given that they do NOT have the disorder). If you take the test (independently) twice simultaneously and it shows that you got positive on one result and negative on another, what's the probability you actually have the disorder?

I've tried to solve this question for a couple of hours now, but I've had no luck. It seems like a Bayes' Theorem problem, but it seems like there are three "given" events to condition on. I'm not completely sure how to approach this problem. Can someone please help me? I'm not entirely sure how to utilize the fact that 3% of the country has a disorder.

I thought it might be the following:

$$\frac{0.03(0.97 \cdot 0.03 + 0.03 + 0.97)}{0.03 \cdot (0.97 \cdot 0.03 + 0.03 \cdot 0.97) + 0.97 \cdot (0.02 \cdot 0.98 + 0.98 \cdot 0.02)} \approx 0.043902,$$

but I'm really not sure.

• Welcome to CV.SE! It is indeed a question about Bayes' theorem. $3\%$ is the prior probability of anyone having this disorder. The question is about updating this probability to account for the fact that you took a diagnostic test for this disease twice, where one result was positive and one negative. – LmnICE Sep 6 '20 at 18:53
• You have a typo at "$97\%$ true positive rate" and "$2\%$ false positive rate". Either it's "$97\%$ true negative rate" or "$2\%$ false negative rate". – LmnICE Sep 6 '20 at 19:04
• I got the problem from a different source and copied it how it was. However, they've also provided interpretations, which I've just updated the post with (see the parentheses after each rate). – user295785 Sep 6 '20 at 19:09
• @LmnICE The true positive rate and the false positive rate don't have to sum to 1, if that's why you're suggesting there's a typo in the question. Imagine a test that always returns positive: it would have a true positive rate of 1 (because all people with the disorder will test positive) and a false positive rate of 1 (because all people without the disorder will also test positive). So the rates would sum to 2. – Eric Perkerson Sep 6 '20 at 19:16
• @ericperkerson I wasn't suggesting that, but I still got the true positive rate and the false positive rate confused. Sorry about that. – LmnICE Sep 6 '20 at 19:19

In order to find the posterior probability, you need two updates on the prior probability of any citizen having this disorder ($$3\%$$).

In general,

$$P(T+| D) \cdot P(D) = P(D | T+) \cdot P(T+)$$,

where $$D$$ means "the citizen has the disorder" and $$T+$$ means "the citizen tests positive".

In this case, $$P(D)=3\%$$ and $$P(T+|D)=97\%$$.

$$P(T+)$$ can be calculated as a partition of a domain:

$$P(T+) = P(T+|D)\cdot P(D) + P(T+|\bar{D})\cdot P(\bar{D})$$,

where $$\bar{D}$$ means "the citizen does not have the disorder", and $$P(\bar{D})=1-0.03=97\%$$. $$P(T+|\bar{D})$$ is the false positive rate (the probability of testing positive given that one doesn't have the disorder). In this case, $$P(T+|\bar{D})=2\%$$. Then,

\begin{align} P(T+) &= 0.97\cdot 0.03 + 0.02\cdot0.97 \\ &= 0.0485 \end{align}

The probability that a citizen has the disorder after testing positive, then, is

\begin{align} P(D|T+) &= \dfrac{0.97}{0.0485}\cdot 0.03 \\ &= 60\% \end{align}

However, they test themselves again, and this time it comes back negative. You just have to apply this procedure again:

$$P(T-|D)\cdot P(D) = P(D|T-)\cdot P(T-)$$,

except you use $$P(D)=60\%$$, the updated probability that a citizen who tested positive has the disorder. In this case,

\begin{align} P(T-|D) &= 1-0.97 = 3\% \\ P(T-|\bar{D}) &= 1-0.02 = 98\% \end{align}

In my calculations, it came out to $$P(D|T-)=4.4\%$$

• This answer doesn't match with the other one. This one says $0.044$, but plugging in the values from the other answer yields $0.0189$. – user295785 Sep 6 '20 at 19:56
• I believe it's because the other answer assumes the tests are independent. In the second test for the disorder, I use $P(D) = 60\%$ because that's the best estimate that we had at the time between the first and second tests. – LmnICE Sep 6 '20 at 20:11
• Ah ok. The tests are taken simultaneously and independently, so I will take the other answer, but I'll upvote your answer since I learned from it. – user295785 Sep 6 '20 at 20:16

Assume the second test is independent of the first test (this means that the second test result is not affected by the first test). The probability that a person who has the disorder gets one + and one - testing results is 2 x 0.03 x 0.97 = 0.0582, while the probability a healthy person gets one + and one - testing results is 2 x 0.02 x 0.98 = 0.0392. Then applying Bayes theorem, we will get

P = (0.03 x 0.0582)/(0.03 x 0.0582 + 0.97 x 0.0392) = 4.39 %

This is the same as LmnICE's result, though the methods are somehow different.

• That is strange. Do you see anything wrong with @ericpekerson's answer? – user295785 Sep 6 '20 at 20:48
• There must be a mistake in my answer, because I tested via simulation and got 4.39%. I've deleted it for now until I can find the mistake. I think we left out the 2 from the binomial coefficient from the probability of one positive and one negative test in the work that was in the comments. – Eric Perkerson Sep 6 '20 at 20:50
• @ericperkerson I thought a bit as to why our answers diverged, and I think you’re correct. Essentially, you can have 4 results: ++, +-, -+ and —. You calculated +-, but forgot to account for the -+. – LmnICE Sep 6 '20 at 21:16
• Where does $2 \times 0.03 \times 0.97$ come from? – user295785 Sep 6 '20 at 21:21
• @ hom: The probability that a person who has the disorder is tested with the result of one + and one -, that is, P(+-|D) + P(-+|D) . – user295357 Sep 6 '20 at 21:29