# probability (Bayes' rule)

In a country, the prevalence of malaria is observed to be 43 out of every 1000 people. The test for malaria is a 90% chance of detecting it when the patient is suffering from malaria. The same test yields a negative result in 95% of the cases of people not infected with malaria. What is the posterior probability that a person has malaria if test returns positive ?

what I have tried is-

$$\frac{0.90 \times 0.043}{(0.90\times0.043+(1-0.95)\times0.043)}$$

is this correct ??

or this-

$$\frac{0.90\times0.043}{(0.90\times0.043+0.95\times0.043)}$$

• Not quite correct.
– Arby
May 9, 2017 at 11:11
• which one first or second? what will be correct sol. then? May 9, 2017 at 11:12
• The first one is almost correct. See my answer below and try to figure out where you're a bit off.
– Arby
May 9, 2017 at 11:14
• More than "a bit" off! The second version produces a numeric result closer to the correct value, but only because it had two mistakes, one that tends to make the result too large and another that tends to make the result too small. May 9, 2017 at 13:29
• No, just a bit off is correct as 6 of the 7 values used were correct, i.e. there was a lot right about the first attempt. Your claim, that it wasn't a bit off as the value was far off the correct value, is true as well, but I prefer to focus on the positive aspects.
– Arby
May 9, 2017 at 23:10

$P(Malaria|Positive Test)=\frac {P(Malaria\cap Positive Test)} {P(Positive Test)}$

$P(Postive Test)=P(Positive Test|Malaria)\cdot P(Malaria) + P(Positive Test|No Malaria)\cdot P(No Malaria)$

The problem in your first attempt is you multiply $P(Positive Test|No Malaria)\cdot P(Malaria)$ instead of $P(Positive Test|No Malaria)\cdot P(No Malaria)$

Spoiler below:

So $P(Malaria|Positive Test)=\frac {.9\cdot \frac {43} {1000}} {.9\cdot \frac {43} {1000}+.05\cdot \frac {957} {1000}}$

When it comes to bayes law I always find it easier to visualize it:

You will note from the diagram below is that there are 2 options for the malaria (when it's positive and the other is negative). You asked What is the posterior probability that a person has malaria if test returns positive which implies in this case option_1 (he really has malaria) but there's another possibility that the test shows positive but he doesn't have it.

so Arby calc is correct and to put it in simple probability terms:

                                 option1
P(Malaria|Positive Test) =  ---------------
option1+option2 what I have tried is-

$$\frac{0.90 \times 0.043}{(0.90\times0.043+(1-0.95)\times0.043)}$$

So close.

That would be ($$T$$ for test-positive, $$M$$ for malaria): $$\dfrac{\mathsf P(T\mid M)\times\mathsf P(M)}{\mathsf P(T\mid M)\times\mathsf P(M)+(1-\mathsf P(T^\complement\mid M^\complement))\times\mathsf P(M)}$$

Where as you clearly want $$\mathsf P(M\mid T)~=~\dfrac{\mathsf P(T\mid M)\times\mathsf P(M)}{\mathsf P(T\mid M)\times\mathsf P(M)+(1-\mathsf P(T^\complement\mid M^\complement))\times(1-\mathsf P(M))}$$