# Question involving Bayes' Rule

The question is as follows:

Suppose a screening test for AIDS has the following features: (i) If a blood sample comes from someone with AIDS then the test will be positive 95% of the time. (ii) If the blood sample comes from someone without AIDS then the test will be negative 95% of the time. Suppose that 5% of the population has AIDS. If a blood sample tests positive, what is the probability that the person whose blood was tested has AIDS?

Now I think the approach to solve this comes from Bayes' Rule. The partition $H_i$ would be if the person has AIDS or not, and the event $A$ would be if the test is positive or not. Would I be correct in assuming this?

Bayes' Rule:

$$\mathbb{P}(H_i\mid A) = \frac{\mathbb{P}(H_i) \mathbb{P}(A\mid H_i)}{\sum_{j=0}^\infty\mathbb{P}(H_j)\mathbb{P}(A\mid H_j)}$$

My guess is :

$$\mathbb{P}(H_i\mid A) = \frac{(0.05)(0.95)}{(0.05)(0.95) + (0.95)(*)(0.95)^2}$$

The star is where I'm not 100% sure.

• That looks right! Why don't you try to plug in the values and show that to us as well ... Commented Dec 10, 2016 at 19:30
• Well the probability of the person testing negative while not having it is 95%, so the probability of it being wrong is 5%? Commented Dec 10, 2016 at 19:49
• Yes, the chance of testing positive for someone who does not have AIDS is indeed 5% or 0.05. So, what is the chance that some random person from this population is a person that does not have AIDS but does test positive? That is, you know P(test positive | does not have AIDS) = 0.05. What is P(test positive and does not have AIDS) = P(test positive | does not have AIDS) * P(does not have AIDS)? Commented Dec 10, 2016 at 19:51
• (0.95)(0.05)? So it is the same as someone who is positive and tested positive? Commented Dec 10, 2016 at 19:54
• Exactly!!! You got it. OK, plus this in .. Commented Dec 10, 2016 at 19:55

The chance of someone testing positive while having AIDS (=0.95*0.05) is the same as the chance of someone testing positive who does not have AIDS (=0.05*0.95)!

So, if you test positive, you are equally likely to have AIDS as to not have AIDS. So, if a person under these conditions tests positive, they have a 50% chance of having AIDS.

Let us say that $H_i \in \{\text{aids}, \text{healthy}\}$ and $A \in \{\text{positive},\text{ negative}\}$. Next, from the problem statement we know that

\begin{align} &\mathbb{P}(A = \text{positive} \mid H_i = \text{aids}) = 0.95\\ &\mathbb{P}(A = \text{negative} \mid H_i = \text{healthy}) = 0.95 \\ & \mathbb{P}(H_i = \text{aids}) = 0.05 \tag 1 \end{align}

and we are asked for the value of $\mathbb{P}(H_i = \text{aids} \mid A = \text{positive})$. Exactly as you proposed, Bayes' rule is what has to be used here. In particular we use

\begin{equation*} \mathbb{P}(H_i = \text{aids} \mid A = \text{positive})= \frac{\mathbb{P}(A = \text{positive} \mid H_i = \text{aids}) \mathbb{P}(H_i = \text{aids}) }{\mathbb{P}(A = \text{positive})} \tag 2 \end{equation*}

From (1) we have all values in the left part of (2) except for the evidence $\mathbb{P}(A = \text{positive})$, which can be computed marginalizing over $H_i$ in the joint probability $\mathbb{P}(A = \text{positive},H_i)$, as highlighted in (3).

\begin{align} \mathbb{P}(A = \text{positive}) = {} & \sum_{H_i} \mathbb{P}(A = \text{positive},H_i) = \sum_{H_i} \mathbb{P}(A = \text{positive}\mid H_i) \mathbb{P}(H_i)\\ = {} & \mathbb{P}(A = \text{positive}\mid H_i = \text{aids}) \mathbb{P}(H_i = \text{aids}) \\ & {} + \mathbb{P}(A = \text{positive}\mid H_i = \text{healthy}) \mathbb{P}(H_i = \text{healthy}) \tag 3 \end{align}

Note that in (3) two new probabilities appear, which however can easily be computed using the complementary probabilities of the given data in (1) as

$$\begin{split} &\mathbb{P}(A = \text{positive} \mid H_i = \text{healthy}) = 1-\mathbb{P}(A = \text{negative} \mid H_i = \text{healthy}) = 0.05\\ & \mathbb{P}(H_i = \text{healthy}) = 1- \mathbb{P}(H_i = \text{aids}) = 0.95 \end{split} \tag 4$$

Substituting the results from (4) in (3) we obtain that $\mathbb{P}(A = \text{positive}) = 0.095$. Finally, using this results we compute (2) as

\begin{equation*} \mathbb{P}(H_i = \text{aids} \mid A = \text{positive})= \frac{0.95\cdot0.05}{0.095} = 0.5 \end{equation*}

The test turns out to be not really trustful. This is basically due to high population percentage having aids.

P.S. I recommend you the reading of these two articles, they are very interesting and can give you rich insights.

Here's one way to do it when the partition of the sample space into two hypotheses ("AIDS" and "no AIDS") has only two parts: $$\frac{\Pr(\text{AIDS} \mid \text{positive})}{\Pr(\text{no AIDS}\mid\text{positive})} = \frac{\Pr(\text{AIDS})}{\Pr(\text{no AIDS})} \times \frac{\Pr(\text{positive}\mid\text{AIDS})}{\Pr(\text{positive} \mid \text{no AIDS})} = \frac 5 {95} \times \frac{95} 5 = 1.$$ Thus $\Pr(\text{AIDS}\mid\text{positive}) = \Pr(\text{no AIDS}\mid \text{positive}).$