Test and probability / Bayes

170 Views Asked by At

There is a virus test with has 95% reliability. We randomly choose one person from a country with 10,000,000 people, in which it is estimated that the number of cases of this virus is 20,000. The selected person is tested positive. What is the probability that this person is actually positive?

This is clearly an example of Bayes theorem use, but I am getting an odd result:

$\mathrm{P}(A \mid Β) = \frac {\mathrm{P}(B \mid A).\mathrm{P}(A)}{\mathrm{P}(B)}$

$\mathrm{P}(A) = \frac {20,000}{10,000,000} = 0.002$

Since the test has 95% reliability, in the entire country (with population 10,000,000), if all were tested, there would be 95,000 people who are sick test positive and 95,000 of the healthy people test negative, therefore a total of 190,000. So:

$\mathrm{P}(B) = \frac {190,000}{10,000,000} = 0.019$ (unconditional probability).

Finally, since the sensitivity of the test is 95%, $\mathrm{P}(B \mid A) = 0.95$.

So from Bayes theorem we get

$\mathrm{P}(A \mid Β) = \frac {0.95*0.002}{0.019} = 0.1$, that is, 10%.

But this is a bit counter-intuitive.

Is it correct? Thank you

2

There are 2 best solutions below

2
On BEST ANSWER

There is a virus test with has 95% reliability.

This sentence is ambiguous. Reliability of a test is a mixture of Sensibility and Specificity.

Let's assume that you mean Sensitivity and Specificity both $95\%$

Thus the number of positive tests is

$$0.95\times 20,000+0.05\times 9,980,000=19,000+499,000=518,000$$

But only $19,000$ are actually positive, thus the PPV (Positive Predictive Value) is

$$PPV=\frac{19,000}{518,000}\approx 3.67\%$$

The result is not counterintuitive because the correct predictive value depends not only on the test reliability but also on the Virus prevalence in the population. That is the reason why mass test on all the population are not recommended.

Try the same exercise with a prevalence of 40% and realize that your PPV is about 93%.

For your exercise, the PPV obviously increases if you repeat the test and it is always positive

$$PPV(1)\approx 3.67\%$$

$$PPV(2)\approx 41.98\%$$

$$PPV(3)\approx 93.22\%$$

$$PPV(4)\approx 99.62\%$$

Where with $PPV(i)$ I mean the probability to have the virus after $i$ consecutive positive tests

0
On

$20000$ are sick of the virus and $9,980,000$ are not sick.

Test has $95\%$ reliability.

Out of $20,000$ sick people -

$19,000$ will test positive and $1000$ will test negative.

Out of $9,980,000$ healthy people,

$499,000$ will test positive and $9,481,000$ will test negative.

Unconditional probability of being sick $P(A) = 0.002$

Unconditional probability of testing positive $P(B) = \frac{499,000+19,000}{10,000,000} = 0.0518$

Probability of testing positive given the person is sick $P(B|A) = 0.95$

So probability of a person really being sick if tested positive,

$\, P(A|B) = \frac{0.95 \times 0.002}{0.0518} \approx 3.67\%$