I have the following problem:
$0.5$% of a population are infected with a dangerous virus. A diagnostic test for the identification of the virus is positive in $99$% for infected people and in $2$% for not infected people.
Please estimate the probability that a person whose test was positive is infected with the virus.
And this is my solution.
Since $0.5$% of the population is infected, then $99.5$% is not infected. Since $99$% of the tests on infected people is positive, then $1$% is negative. Similarly, we can conclude that $98$% of the tests in not infected people is negative.
What we need to find, probability that a person whose test was positive is infected with the virus or in other words that a person is infected given that the test was positive, can be expressed (using the Bayes' theorem) as $$p( P_I \mid T_P) = \frac{p(P_I)\cdot p(T_P \mid P_I)}{p(T_P)}$$
Where $P_I$ means person is infected and $T_P$ means tests are positive.
Now, we know $p(P_I)$, that is $\frac{0.5}{100} = 0.005$, and we also know $p(T_P \mid P_I) = \frac{99}{100} = 0.99$. We only need to find $p(T_P)$, that is the probability that tests are positive. For this purpose, we can use the law of the total probability in the following way:
$$p(T_P) = p(P_I)\cdot p(T_P \mid P_I) + p(\overline{P_I}) \cdot p(T_P \mid \overline{P_I}) = 0.005 \cdot 0.99 + 0.995\cdot 0.02 = 0.02485$$
We can now plug the numbers in the first equation
$$p( P_I \mid T_P) = \frac{0.005 \cdot 0.99}{0.02485} = 0.19919517102615694$$
That is the probability that person is infected given that the tests are positive is roughly $20$%.
Is my solution correct?
This $20$% does not convince me honestly...