d2jsp
Log InRegister
d2jsp Forums > Off-Topic > General Chat > Homework Help > Bayes' Theorem
Add Reply New Topic New Poll
Member
Posts: 12,037
Joined: Jun 3 2006
Gold: 6,723.69
Jun 21 2017 12:00pm
Hiho,

Consider country A. 6% of its inhabitants is infected with malaria. A test was developed to track down malaria. This test is not always correct. The test gives an incorrect result for 1% of the healthy inhabitants. The test gives an incorrect result for 2% of the infected inhabitants. What are the odds for someone tested positive for malaria to actually be infected with malaria?

A. 0.06
B. 0.068
C. 0.86
D. 0.99
E. 0.0595



I have absolutely no idea how to apply Bayes' theorem here, but alas, here's what I've got.
Code
Out of x positive tests, 1% is a false positive and thus 99% of the positive tests are true positives.
Let positive outcome = p and let infected inhabitant = i, negative outcome = np and not infected = ni
P(p and i)=0,99
P(i)=0,06
P(p and ni) = 0,01
P(ni) = 0,94 (the remainder of the inhabitants, 1,00 - 0,06)

I'm looking for the chance that a positive outcome means that the inhabitant is indeed infected: P(i|p)
P(i|p) is defined as P(i and p) / P(p)
P(i and b) / P(p) = (0,99 * 0,06) / (0,99*0,06 + 0,01 * 0,94) = 0,8634 ----> C is correct


It feels counterintuitive to multiply P(p) by the amount of inhabitants that are infected (0,99*0,06 instead of 0,99)? I did it anyway because the answer I would've gotten otherwise seems ridiculous.
I know C is indeed the right answer. Maybe somebody could answer this particular assignment in words so I can have a better understanding of what the numbers mean.

This post was edited by Forg0tten on Jun 21 2017 12:06pm
Member
Posts: 16,662
Joined: Nov 24 2007
Gold: 15,245.00
Trader: Trusted
Jun 22 2017 12:45pm
You are asked the probability of someone being infected, knowing that the test is positive.

Answer = p1 / p2
where :
p1 = probability of someone being infected and the test being positive,
p2 = probability of the test being positive.

Indeed, only people with positive tests have something to do with your problem. You don't care about the others.
Among those people, how many have a positive test because they are infected, and how many because it's a failure of the test ?

With your figures :

p1 = 6% times 98% = 0.06 x 0.98 = 0.0588

p2 = 6% times 98% + 94% times 1% = 0.06 x 0.98 + 0.94 x 0.01 = 0.0588 + 0.0094 = 0.0682

Answer = 0.0588 / 0.0682 = 294 / 341 ~ 0.86
86% approximately.
Member
Posts: 12,037
Joined: Jun 3 2006
Gold: 6,723.69
Jun 23 2017 12:43am
Quote (feanur @ Jun 22 2017 07:45pm)
You are asked the probability of someone being infected, knowing that the test is positive.

Answer = p1 / p2
where :
p1 = probability of someone being infected and the test being positive,
p2 = probability of the test being positive.

Indeed, only people with positive tests have something to do with your problem. You don't care about the others.
Among those people, how many have a positive test because they are infected, and how many because it's a failure of the test ?

With your figures :

p1 = 6% times 98% = 0.06 x 0.98 = 0.0588

p2 = 6% times 98% + 94% times 1% = 0.06 x 0.98 + 0.94 x 0.01 = 0.0588 + 0.0094 = 0.0682

Answer = 0.0588 / 0.0682 = 294 / 341 ~ 0.86
86% approximately.


I understand!
Just making absolutely sure here, you used 2% and 98% rather than 1% and 99%; but the 2% I think, is about people who are infected and tested negative. I don't think we need that, we want to use the people who are tested positive (regardless of infected or not)?
Member
Posts: 16,662
Joined: Nov 24 2007
Gold: 15,245.00
Trader: Trusted
Jun 23 2017 01:00pm
Yes : if 2% of infected people are tested negative, then 98% (100% - 2%) are tested positive.
That's why, on the whole population, 6 % times 98% are people infected and with positive tests.

Quote
the people who are tested positive (regardless of infected or not)

are counted with p2 :
  • if infected : 6% times 98%, as seen above
  • if not infected : 94% times 1%

and p2 is the sum of those 2 figures.

This post was edited by feanur on Jun 23 2017 01:01pm
Member
Posts: 12,037
Joined: Jun 3 2006
Gold: 6,723.69
Jun 23 2017 01:48pm
Oh boy, I turned those two around. I should learn to read the assignment properly before working the numbers -_-
Go Back To Homework Help Topic List
Add Reply New Topic New Poll