[Math] Bayes Theorem Drug Testing

bayes-theoremprobabilityprobability theory

A large company gives a new employee a drug test. The False-Positive
rate is 3% and the False-Negative rate is 2%. In addition, 2% of the
population use the drug. The employee tests positive for the drug.
What is the probability the employee uses the drug?

Here is what I have so far:

X={employee uses drugs}

Y={employee tests positive in the drug test}

P(X|Y) = 0.97

P(notX|Y) = 0.03

P(X|notY) = 0.02

P(notX|notY) = 0.98

P(X) = 0.02

I want to find P(Y|X) = $\frac{P(X|Y) P(Y)}{P(X)}$
however, I'm having trouble finding P(Y).

What I know I should be using is P(Y) = P(Y|X) P(X) + P(Y|notX) P(notX)
but I get results over 1 when I plug this formula 🙁 What am I doing wrong?

Thanks in advance for your help!

Best Answer

Hint: You have confused throughout your solution (which however is methodologically correct) the roles of $X$ and $Y$. You know that

  1. $P(Y|X)=0.98\, (=1-$False Negative) and
  2. $P(Y|X^c)=0.03$

Accordingly you have confused $P(Y|X)$ with the actual required probability which is $P(X|Y)$. For the calculation of $P(Y)$ which will come in the denominator of the Bayes fromula you should use the Law of total probability (as you have done $$P(Y)=P(Y|X)P(X)+P(Y|X^c)P(X^c)=0.98\cdot0.02+0.03\cdot0.98=0.049$$