7  Bayes’ Theorem With LEGO

The chapter starts with a small change in Bayes’ theorem:

Theorem 7.1 (Bayes’ Theorem (Variation 2)) \[ P(A \mid B) = \frac{P(B \mid A) \times P(A)}{P(B)} \tag{7.1}\]

In contrast with Equation 6.3 the order of the terms of the multiplication in the nominator is changed. The meaning of the formula is identical, but sometimes changing the terms around can help clarify different approaches to problems. (By the way: This is the form of the formula that is most used in the literature.)

There is no new statistical content taught in this chapter The author tries to solidify the mathematics behinds the intuition by using LEGO bricks to visualize Bayes’ theorem.

7.1 Exercises

Try answering the following questions to see if you have a solid understanding of how we can use Bayes’ Theorem to reason about conditional probabilities. The solutions can be found at https://nostarch.com/learnbayes/.

7.1.1 Exercise 7-1

Kansas City, despite its name, sits on the border of two US states: Missouri and Kansas. The Kansas City metropolitan area consists of 15 counties, 9 in Missouri and 6 in Kansas. The entire state of Kansas has 105 counties and Missouri has 114. Use Bayes’ theorem to calculate the probability that a relative who just moved to a county in the Kansas City metropolitan area also lives in a county in Kansas. Make sure to show \(P(Kansas)\) (assuming your relative either lives in Kansas or Missouri), \(P(\text{Kansas City metropolitan area})\), and \(P(\text{Kansas City metropolitan area}| Kansas)\).

US states: 219 counties = 105 Kansas, 114 Missouri Kansas City: 15 counties = 6 Kansas, 9 Missouri

Intuitively: \(\frac{6}{15} = \frac{2}{5}\)

$$ \[\begin{align*} P(\text{County in Kansas} | \text{Kansas City}) = \frac{P(\text{Kansas City} | \text{County in Kansas}) \times P(\text{County in Kansas})}{P(\text{Kansas City})} \\ = \frac{\frac{6}{105} \times \frac{105}{219}}{\frac{15}{219}} = \frac{\frac{6}{219}}{\frac{15}{219}} = \frac{6}{15} = \frac{2}{5} \end{align*}\] $$

7.1.2 Exercise 7-2

A deck of cards has 52 cards with suits that are either red or black. There are four aces in a deck of cards: two red and two black. You remove a red ace from the deck and shuffle the cards. Your friend pulls a black card. What is the probability that it is an ace?

Cards: 51 cards = 26 black, 25 red Aces: 3 aces = 2 black, 1 red \(P(ace | \text{black card})\)?

$$ \[\begin{align*} P(ace | \text{black card}) = \frac{P(\text{black card} | ace) \times P(ace))}{P(\text{black card})} \\ = \frac{\frac{2}{3} \times \frac{3}{51}}{\frac{26}{51}} = \frac{\frac{6}{153}} {\frac{26}{51}} = \frac{6 \times 51} {26 \times 153} = \frac{6}{26} \times \frac{1}{3} = \frac{2}{26} = \frac{1}{13} \end{align*}\] $$ Or more easily without Bayes’ rule: We have 26 black cards with 2 aces = \(P(\frac{2}{26}) = \frac{1}{13}\)