Bayes theorem and application

171 Views Asked by At

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?

2

There are 2 best solutions below

0
On

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$$

0
On

Let $A=A_1\cap A_2$ be the event that two tests are positive. And $H_1$ denote being pregnant, $H_2$ - not to be pregnant. Assumed that $A_1$ and $A_2$ are conditionally independent for a single person, so $$ \mathbb P(A \mid H_1)=\mathbb P(A_1 \mid H_1)\times \mathbb P(A_2 \mid H_1) = 0.97^2, $$ $$ \mathbb P(A \mid H_2)=\mathbb P(A_1 \mid H_2)\times \mathbb P(A_2 \mid H_2) = 0.02^2, $$ and Bayes formula gives $$ \mathbb P(H_1 \mid A) = \frac{\mathbb P(H_1)\times \mathbb P(A \mid H_1)}{\mathbb P(H_1)\times \mathbb P(A \mid H_1)+\mathbb P(H_2)\times \mathbb P(A \mid H_2)} = \frac{0.6\times 0.97^2}{0.6\times 0.97^2+0.4\times 0.02^2}=0.999716664. $$