Probability help

Hey guys I'm new to this site, and I could really use some help!

I am currently in a stats class and I'm so terrible with numbers it's not even funny. I have on hw question that seems easy enough and I've worked through it some, but I'm just not sure if it is correct.

Here is the problem:
The overall prevalence of HIV is 2% of the population. The HIV diagnostic exam has
sensitivity (probability of detecting HIV given that the person is infected) of 0.98 and specificity
(probability of giving a negative result given that the person is not infected) of 0.95. What is the
probability that the person is infected, given a positive test result? Based on your previous answer,
should HIV testing be required for everyone?

And here is what I have worked out so far:
P(positive test result / person is infected) = 0.98
or, P(positive test result and person is infected)/P(person is infected) = 0.98
or, P(positive test result and person is infected) = 0.98*0.02 = 0.0196

Can someone please tell me if this is right or if not help me work through it so I can understand!



TS Contributor
you need to work out the probability(infected|positive) by applying the Bayes formula

p(A|B)=P(B|A)*P(A)/P(B) with A - infected, B - test positive.

P(B) can be expressed as P(B)=P(B|A)*P(A)+ P(B|not A)*P(not A).

The necessary conditional probabilities are provided in the problem. Good luck and don't be too surprised :)