Bayes' Theorem
Bayes' Theorem allows us to calculate the probability of a specific event A, based on the information we have about event B. $$ p(A|B) = \frac{ p(A) \cdot p(B|A) }{ p(B) } $$
- p(A|B) and p(B|A) are conditional (posterior) probabilities
- p(A) and p(B) are prior (simple) probabilities
How does conditional probability work? Conditional probability p(A|B) represents the likelihood of event A occurring, given that event B has already occurred.
A practical example
A population is composed of 40% males and 60% females.
All men wear pants, while women wear pants 50% of the time and skirts the other 50% of the time.
An observer sees someone in the distance wearing pants.
What is the probability that this person is female?
The prior probability ( event A ) of the person being female is 60%.
$$ p(A) = 0.6 $$
Note. This is a straightforward estimate based on the population makeup, but it’s not precise enough to answer the question reliably.
The prior probability that a person is wearing pants ( event B ) is 70%.
$$ p(B) = 0.7 $$
Note. All men wear pants (40% of the population), and half of the women do (30%). Therefore, 70% of the population wears pants.
According to the data, the conditional probability (posterior) that a woman (event A) is wearing pants (event B) is 50%.
$$ p(B|A) = 0.5 $$
Note. Half of the women in the population wear pants. This 50% refers only to the female population, not the total population.
Now, we can apply Bayes' Theorem to calculate the probability that the person wearing pants (event B) is female (event A).
$$ p(A|B) = \frac{ p(A) \cdot p(B|A) }{ p(B) } $$
By substituting the known probabilities, we can solve the problem.
$$ p(A|B) = \frac{ 0.6 \cdot 0.5 }{ 0.7 } $$
$$ p(A|B) = 0.43 $$
So, there is a 43% chance that the person observed from a distance is female.
This is the conditional probability of event A (female), given the information we have about event B (pants).
Note. Initially, the prior probability p(A) of the person being female was 60%. The conditional probability, however, is reduced to 43%, which is more accurate because it incorporates the additional information from event B.
This is a simple example of how Bayes' Theorem can be applied in practice.
And so on.