Understanding the Law of Total Expectation with Examples

The Law of Total Expectation, also known as the Law of Total Probability for expectations, is a fundamental concept in probability theory. It helps us find the expected value of a random variable by considering all possible scenarios that can influence it.

What Is the Law of Total Expectation?

The Law of Total Expectation states that if we have a random variable X and a partition of the sample space into events B1, B2, …, Bn, then:

E[X] = Σi=1 to n E[X | Bi] P(Bi)

Understanding the Formula

This formula means that the overall expected value of X can be calculated by summing the expected values of X within each scenario Bi, weighted by the probability of each scenario.

Example 1: Rolling a Die

Suppose you roll a fair six-sided die. Define X as the outcome of the die. You want to find the expected value of X.

Let’s partition the sample space into two events:

  • B1: The die shows an even number
  • B2: The die shows an odd number

Calculate E[X | Bi] and P(Bi) for each event:

  • For B1: outcomes are 2, 4, 6. E[X | B1] = (2 + 4 + 6) / 3 = 4. P(B1) = 3/6 = 0.5.
  • For B2: outcomes are 1, 3, 5. E[X | B2] = (1 + 3 + 5) / 3 = 3. P(B2) = 3/6 = 0.5.

Apply the Law of Total Expectation:

E[X] = (4)(0.5) + (3)(0.5) = 2 + 1.5 = 3.5

Example 2: Disease Testing

Imagine a disease test that is 99% accurate. Suppose 1% of the population has the disease. Define X as the number of true positives in a group.

Partition the sample space into:

  • B1: The person has the disease
  • B2
  • : The person does not have the disease

Calculate E[X | Bi] and P(Bi):

  • P(B1) = 0.01, P(B2) = 0.99.
  • Given the person has the disease, the test correctly identifies it 99% of the time, so E[X | B1] ≈ 0.99.
  • Given no disease, the false positive rate is 1%, so E[X | B2] ≈ 0.01.

Calculate the overall expected number of true positives:

E[X] = (0.99)(0.01) + (0.01)(0.99) = 0.0099 + 0.0099 = 0.0198

Conclusion

The Law of Total Expectation simplifies complex problems by breaking them into manageable parts. It is an essential tool for statisticians, data analysts, and anyone working with probabilistic models. Understanding how to apply it with real-world examples enhances both teaching and learning in probability and statistics.