## 1. HIV test

An HIV test gives a positive result with probability 98% when the patient is indeed affected by HIV, while it gives a negative result with 99% probability when the patient is not affected by HIV. If a patient is drawn at random from a population in which 0,1% of individuals are affected by HIV and he is found positive, what is the probability that he is indeed affected by HIV?

P(positive|HIV) = 0.98

P(positive|NO HIV) = 1-0.99 = 0.01

P(HIV) = 0.001

P(NO HIV) = 1-0.001 = 0.999

Furthermore, the unconditional probability of being found positive can be derived using the law of total probability:

P(positive) = P(positiveHIV)P(HIV)+P(positive|NO HIV)P(NO HIV) = 0.98*0.001+0.01*0.999 = 0.00098+0.00999 = 0.01097

Therefore, Bayes' rule gives

P(HIV|positive) = P(positive|HIV)P(HIV) / P(positive) = 0.98*0.001 / 0.01097 = 0.00098/0.01097 ≈ 0.08933

Therefore, even if the test is conditionally very accurate, the unconditional probability of being affected by HIV when found positive is less than 10 per cent!

Source: http://www.statlect.com/fundamentals-of-probability/Bayes-rule

## 2. Urns with colored balls

There are two urns containing colored balls. The first urn contains 50 red balls and 50 blue balls. The second urn contains 30 red balls and 70 blue balls. One of the two urns is randomly chosen (both urns have probability $50%$ of being chosen) and then a ball is drawn at random from one of the two urns. If a red ball is drawn, what is the probability that it comes from the first urn?

In probabilistic terms, what we know about this problem can be formalized as follows:

P(red|urn 1) = 1/2

P(red|urn 2) = 3/10

P(urn 1) = 1/2

P(urn 2) = 1/2

The unconditional probability of drawing a red ball can be derived using the law of total probability:

P(red) = P(red|urn 1)P(urn 1) + P(red|urn 2)P(urn 2) = 1/2*1/2+3/10*1/2 = 1/4+3/20 = (5+3)/20 = 2/5

By using Bayes' rule, we obtain

P(urn 1|red) = P(red|urn 1)P(urn 1) / P(red) = (1/2*1/2) / 2/5 = 1/4*5/2 = 5/8

Source: http://www.statlect.com/fundamentals-of-probability/Bayes-rule

## 3. Recessions predict

An economics consulting firm has created a model to predict recessions. The model predicts a recession with probability 80% when a recession is indeed coming and with probability 10% when no recession is coming. The unconditional probability of falling into a recession is 20%. If the model predicts a recession, what is the probability that a recession will indeed come?

What we know about this problem can be formalized as follows:

P(rec. pred.|rec. coming) = 8/10

P(rec. pred.|rec. not coming) = 1/10

P(rec. coming) = 2/10

P(rec. not coming) = 1-P(rec. coming) = 1-2/10 = 8/10

The unconditional probability of predicting a recession can be derived by using the law of total probability:

P(rec. pred.) = P(rec. pred.|rec. coming)P(rec. coming) + P(rec. pred.|rec. not coming)P(rec. not coming) = 8/10 * 2/10 + 1/10 * 8/10 = 24/100

Bayes' rule implies

P(rec. coming|rec. pred.) = P(rec. pred.|rec. coming)P(rec. coming) / P(rec. pred.) = (8/10 * 2/10) / 24/100 = 16/100 * 100/24 = 2/3

Source: http://www.statlect.com/fundamentals-of-probability/Bayes-rule

## 4. Two coins

Alice has two coins in her pocket, a fair coin (head on one side and tail on the other side) and a two-headed coin. She picks one at random from her pocket, tosses it and obtains head. What is the probability that she flipped the fair coin?

What we know about this problem can be formalized as follows:

P(head|fair coin) = 1/2

P(head|unfair coin) = 1

P(fair coin) = 1/2

P(unfair coin) = 1/2

The unconditional probability of obtaining head can be derived by using the law of total probability:

P(head) = P(head|fair coin)P(fair coin) + P(head|unfair coin)P(unfair coin) = 1/2 * 1/2 + 1 * 1/2 = 1/4 + 2/4 = 3/4

With Bayes' rule, we obtain

P(fair coin|head) = P(head|fair coin)P(fair coin) / P(head) = (1/2 * 1/2) / 3/4 = 1/4 * 4/3 = 1/3

Source: http://www.statlect.com/fundamentals-of-probability/Bayes-rule

## 5. Elvis's twin

Elvis Presley had a twin brother who died at birth. What is the probability that Elvis was an identical twin?

To answer this one, you need some background information: According to the Wikipedia article on twins: ""Twins are estimated to be approximately 1.9% of the world population, with monozygotic twins making up 0.2% of the total and 8% of all twins."

There are several ways to set up this problem; I think the easiest is to think about twin birth events, rather than individual twins, and to take the fact that Elvis was a twin as background information.

So the hypotheses are

- A: Elvis's birth event was an identical birth event
- B: Elvis's birth event was a fraternal twin event

If identical twins are 8% of all twins, then identical birth events are 8% of all twin birth events, so the priors are

- P(A) = 8%
- P(B) = 92%

The relevant evidence is

E: Elvis's twin was male

So the likelihoods are

- P(E|A) = 1
- P(E|B) = 1/2

Because identical twins are necessarily the same sex, but fraternal twins are equally likely to be opposite sex (or, at least, I assume so). So

P(A|E) = 8/54 ~ 0.15.

The tricky part of this one is realizing that the sex of the twin provides relevant information!

Source: http://allendowney.blogspot.ru/2011/10/my-favorite-bayess-theorem-problems.html