Bayes theorem : Exercises


In what follows a full written solution is provided to the problem that was discussed in the video. For the remainder of the problems only the final solution is given.

Example problems

Click on the problems to reveal the solution

Problem 1

The first step in solving this problem is to recognize what we are trying to calculate and what quantities we have been given in the question. We can introduce a Bernoulli random variable and say that $D=1$ when the person has the disease. We can then introduce a second Bernoulli random variable $T$ and say that $T=1$ when a person gets a positive test result. We then note that these two random variables are not independent. With these symbols in place we can now state clearly what it we are trying to calculate. We are trying to calculate the conditional probability $P(D=1|T=1)$. In addition, the question tells us that: $$ P(D=1)=0.001 \qquad \qquad P(T=1|D=1)=0.990 \qquad \qquad P(T=1|D=0)=0.005 $$ From these quantities we can the probability of getting a positive test result, $P(T=1)$ using the partition theorem as shown below: $$ P(T=1) = P(T=1|D=1)P(D=1) + P(T=1|D=0)P(D=0) = P(T=1|D=1)P(D=1) + P(T=1|D=0)[1-P(D=1)] = 0.99 \times 0.1 + 0.005 \times ( 1 - 0.001 ) = 0.005985 $$ We can now insert this result into Bayes theorem to get the desired conditional probability. $$ P(D=1|T=1) = \frac{P(T=1|D=1)P(D=1)}{P(T=1)} = \frac{0.99 \times 0.001}{0.005985} \approx 0.165 $$

Problem 2

Problem 3

Problem 4

Problem 5

Contact Details

School of Mathematics and Physics,
Queen's University Belfast,

Website: mywebsite