1. Home
  2. Explore
  3. Statistics
  4. Bayes’ Theorem

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Bayes’ Theorem

Bayes’ Theorem and Reversing Conditional Probabilities

The question Bayes’ theorem answers

A conditional probability describes the likelihood of an event when another event is known to have occurred. In many problems, the available information gives one conditional probability, but the question asks for the reverse.

For example, an insurance company may know the probability that a policyholder dies during a year given that the person is a smoker. The question may instead ask for the probability that a policyholder was a smoker given that the person died.

These are different probabilities:

  • P(D∣S)P(D \mid S)P(D∣S): the probability of dying given that the person is a smoker.

  • P(S∣D)P(S \mid D)P(S∣D): the probability of being a smoker given that the person died.

In general, reversing the order of the events changes the conditional probability. Bayes’ theorem provides a way to find the reversed probability.


Insurance example

Suppose policyholders belong to one of two groups: smokers or non-smokers. These groups are mutually exclusive, and together they include all policyholders.

Let:

  • SSS be the event that a policyholder is a smoker.

  • NNN be the event that a policyholder is a non-smoker.

  • DDD be the event that a policyholder dies during the year.

The information is:

  • P(S)=0.10P(S) = 0.10P(S)=0.10: 10%10\%10% of policyholders are smokers.

  • P(N)=0.90P(N) = 0.90P(N)=0.90: 90%90\%90% are non-smokers.

  • P(D∣S)=0.05P(D \mid S) = 0.05P(D∣S)=0.05: a smoker has a 5%5\%5% probability of dying during the year.

  • P(D∣N)=0.01P(D \mid N) = 0.01P(D∣N)=0.01: a non-smoker has a 1%1\%1% probability of dying during the year.

The desired probability is:

P(S∣D)P(S \mid D)P(S∣D)

That is, among policyholders who died, what proportion were smokers?


Starting from the definition of conditional probability

By definition,

P(S∣D)=P(S∩D)P(D)P(S \mid D) = \frac{P(S \cap D)}{P(D)}P(S∣D)=P(D)P(S∩D)​

The numerator represents the probability that a policyholder was both a smoker and died. The denominator represents the probability that a policyholder died, regardless of smoking status.

The given information does not directly provide either of these probabilities. However, the definition of conditional probability allows the numerator to be expressed using the information that is available:

P(D∣S)=P(D∩S)P(S)P(D \mid S) = \frac{P(D \cap S)}{P(S)}P(D∣S)=P(S)P(D∩S)​

Rearranging gives:

P(S∩D)=P(D∣S)P(S)P(S \cap D) = P(D \mid S)P(S)P(S∩D)=P(D∣S)P(S)

Therefore,

P(S∩D)=0.05×0.10=0.005P(S \cap D) = 0.05 \times 0.10 = 0.005P(S∩D)=0.05×0.10=0.005

So, 0.0050.0050.005 of the entire policyholder population are both smokers and people who die during the year.


Finding the overall probability of death

The denominator P(D)P(D)P(D) includes deaths among both smokers and non-smokers. Since SSS and NNN divide the entire population into two groups, every death occurs in one of these groups.

The events SSS and NNN form a partition of the sample space because:

  • They are mutually exclusive: S∩N=∅S \cap N = \varnothingS∩N=∅.

  • Together, they cover the whole sample space: S∪N=ΩS \cup N = \OmegaS∪N=Ω.

The death event can therefore be divided into deaths among smokers and deaths among non-smokers:

D=(D∩S)∪(D∩N)D = (D \cap S) \cup (D \cap N)D=(D∩S)∪(D∩N)

These two intersection events are mutually exclusive, so their probabilities add:

P(D)=P(D∩S)+P(D∩N)P(D) = P(D \cap S) + P(D \cap N)P(D)=P(D∩S)+P(D∩N)

The second intersection is found using the same conditional-probability relationship:

P(D∩N)=P(D∣N)P(N)P(D \cap N) = P(D \mid N)P(N)P(D∩N)=P(D∣N)P(N)

Substituting the given values:

P(D∩N)=0.01×0.90=0.009P(D \cap N) = 0.01 \times 0.90 = 0.009P(D∩N)=0.01×0.90=0.009

Thus, the overall probability of death is:

P(D)=(0.05×0.10)+(0.01×0.90)P(D) = (0.05 \times 0.10) + (0.01 \times 0.90)P(D)=(0.05×0.10)+(0.01×0.90)
P(D)=0.005+0.009=0.014P(D) = 0.005 + 0.009 = 0.014P(D)=0.005+0.009=0.014

Calculating the probability that a person who died was a smoker

Substitute the numerator and denominator into the conditional-probability formula:

P(S∣D)=P(S∩D)P(D)=0.05×0.10(0.05×0.10)+(0.01×0.90)P(S \mid D) = \frac{P(S \cap D)}{P(D)} = \frac{0.05 \times 0.10}{(0.05 \times 0.10) + (0.01 \times 0.90)}P(S∣D)=P(D)P(S∩D)​=(0.05×0.10)+(0.01×0.90)0.05×0.10​

Therefore,

P(S∣D)=0.0050.014=514≈0.357P(S \mid D) = \frac{0.005}{0.014} = \frac{5}{14} \approx 0.357P(S∣D)=0.0140.005​=145​≈0.357

So, the probability that a policyholder was a smoker given that the policyholder died is approximately 35.7%35.7\%35.7%.

This is not the same as the 10%10\%10% of policyholders who are smokers. Smokers have a higher probability of dying during the year, so they make up a larger share of those who die than of the overall policyholder population.


Bayes’ theorem

The example leads to the general form of Bayes’ theorem. For events AAA and BBB, provided P(B)>0P(B) > 0P(B)>0,

P(A∣B)=P(B∣A)P(A)P(B)P(A \mid B) = \frac{P(B \mid A)P(A)}{P(B)}P(A∣B)=P(B)P(B∣A)P(A)​

When AAA and its complement AcA^cAc form a partition of the sample space, the denominator can be expanded as:

P(B)=P(B∣A)P(A)+P(B∣Ac)P(Ac)P(B) = P(B \mid A)P(A) + P(B \mid A^c)P(A^c)P(B)=P(B∣A)P(A)+P(B∣Ac)P(Ac)

Thus, Bayes’ theorem can also be written as:

P(A∣B)=P(B∣A)P(A)P(B∣A)P(A)+P(B∣Ac)P(Ac)P(A \mid B) = \frac{P(B \mid A)P(A)} {P(B \mid A)P(A) + P(B \mid A^c)P(A^c)}P(A∣B)=P(B∣A)P(A)+P(B∣Ac)P(Ac)P(B∣A)P(A)​

In the insurance example, AAA is the event of being a smoker and BBB is the event of dying. The theorem converts the known probability P(D∣S)P(D \mid S)P(D∣S) into the desired probability P(S∣D)P(S \mid D)P(S∣D) by combining the conditional death rates with the proportions of smokers and non-smokers in the population.

Bayes’ theorem is used when a problem provides a conditional probability in one direction but asks for the probability in the reverse direction. The population proportions and the overall probability of the observed event must also be taken into account.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent