A pregnancy test is accurate 97% of the time when someone is pregnant and 98% accurate when someone is not. Assuming that 60% of people who take the test are pregnant, and that someone tests positive twice in a row, what is the probability they actually are pregnant?
I think this is application of Bayes theorem but I don't know how to incorporate it in above situation?
Let $+$ denote a positive test, and $P$ denote being pregnant.
We are given the prior $p(P)=0.6$ and $p(+|P)=0.97$ and $p(+|\neg P)=0.98$. Hence $$p(P|+)=\frac{p(+|P)p(P)}{p(+|P)p(P)+p(+|\neg P)p(\neg P)}$$ $$=\frac{0.97\times0.6}{0.97\times0.6+0.02\times0,4}=0.9864$$ That now becomes the prior for the 2nd test so we have $$p(P|++)=\frac{0.97\times0.9864}{0.97\times0.9864+0.02\times0.0136}=0.9997$$