I am currently trying to answer this question and am though a bit confused on how to apply Bayes Theorem when a second test is performed based on the result of the first.
A test to determine who is under the influence of a drug has a probability of 0.8 of being correct (i.e for both positive and negative results).
If the test is positive, a second different test is carried out. The second test always correctly detects if the patient is in fact not under under the influence of the drug, but has a 10% error rate with drug users/under the influence.
If 20% of the patients tested are actually users/under the influence we are asked to calculate:
a) Proportion of patients that have to be given the second test (i.e proportion of testing positive on the first test) b) probability patients testing positive on the first test are really under the influence/drug users c) probability that patients testing negative on the second test are actually under the influence/drug users;
For a) I am not sure I've arrived at the correct solution,as its 30% more than the population of 20% who are actually users.
d - drug user/under the influence c - not under the influence/not a drug user
$P(d|+) = \frac{P(+|d)*P(d)}{P(+)*P(+|d) + P(+|c)*P(c)} = \frac{0.2*0.8}{(0.2*0.8 + 0.2*0.8)} = 0.50 $ i.e % 50% of patients will test positive on first test
b) I am immediately confused by this question and c). I have followed the rationale of this question Conditional probability and testing twice, and found the answer below:
P1 = first test P2 = second test
Then the desired probability is $$\Pr[P_2 \mid P_1] = \frac{\Pr[P_2 \cap P_1]}{\Pr[P_1]} = \frac{\Pr[P_2 \cap P_1 \mid d]\Pr[d] + \Pr[P_2 \cap P_1 \mid c]\Pr[c]}{\Pr[P_1 \mid d]\Pr[d] + \Pr[P_1 \mid c]\Pr[c]} = \frac{(0.8+0.9)*0.2 + (0.8+1)*0.8}{0.8*0.2 + 0.8*0.8} = 5.5625 $$
This is obviously not correct, I am not sure where I went wrong here. Any hints/answers are welcomed I am new to Bayesian Theory.