Statistical Rethinking: Chapter 2 Practice Answers

2E1

2E2

2E3

2E4

To say that "the probability of water is 0.7" is a reflection of our certainty that the globe will yield water. It is an epistemological claim about us as an observer, not an absolute, objective claim about the mechanics of the globe. With an accurate enough physical model we could predict with far greater than 0.7 accuracy whether the globe will yield water or land.

2M1

Here we use some of the code from the pymc-devs Python/pymc3 port of the Statistical Rethinking code examples.

(1)

(2)

(3)

2M2

(1)

(2)

(3)

2M3

$$P(\text{Earth}|\text{land}) = \frac{P(\text{Earth}, \text{land})}{P(\text{land})}$$$$= \frac{P(\text{land}|\text{Earth})P(\text{Earth})}{P(\text{land})}$$$$= \frac{P(\text{land}|\text{Earth})P(\text{Earth})}{\sum_{p \in \text{planets}}P(\text{land}|\text{p})P(p)}$$

Now substituting in the known values in their respective locations:

2M4

This is a rewording of Bertrand's box paradox.

Personally, the difficulty with this problem is not the counterintuitive answer, but converting the information we know about the problem into the language of probability.

We want to know: $P(\text{black down}|\text{black up})$

$$P(\text{black down}|\text{black up}) = \frac{P(\text{black down}, \text{black up})}{P(\text{black up})}$$$$= \frac{P(\text{black down}, \text{black up})}{P(\text{black up})}$$$$= \frac{P(\text{black down}, \text{black up})}{\sum_{c \in \text{cards}}P(\text{black up}|c)P(c)}$$$$= \frac{P(\text{B/B card})}{P(\text{black up}|\text{B/B card})P(\text{B/B card})+P(\text{black up}|\text{B/W card})P(\text{B/W card})}$$

We omit the third term in the denominator that corresponds to the $W/W$ card since we know it can't show a black face and so that term is 0. Substituting in known probabilities:

2M5

$$P(\text{black down}|\text{black up}) = \frac{P(\text{black down}, \text{black up})}{P(\text{black up})}$$$$= \frac{P(\text{black down}, \text{black up})}{P(\text{black up})}$$$$= \frac{P(\text{B/B card})}{\sum_{c \in \text{cards}}P(\text{black up}|c)P(c)}$$

Substituting the values in:

2M6

$$P(\text{B/B card}) = 1/6$$$$P(\text{B/W card}) = 2/6$$$$P(\text{W/W card}) = 3/6$$$$P(\text{black down}|\text{black up}) = \frac{P(\text{B/B card})}{\sum_{c \in \text{cards}}P(\text{black up}|c)P(c)}$$

2M7

This is a bit more overwhelming, but all the same rules apply. The sums are there to marginalize out variables, and we omit terms where we know the probability is zero.

$$P(\text{black down card 1}|\text{black up card 1},\text{white up card 2})$$$$=\frac{P(\text{B/B card 1}, \text{white up card 2})}{P(\text{black up card 1},\text{white up card 2})}$$$$=\frac{P(\text{B/B card 1})P(\text{white up card 2}|\text{B/B card 1})}{P(\text{black up card 1},\text{white up card 2})}$$$$=\frac{P(\text{B/B card 1})P(\text{white up card 2}|\text{B/B card 1},\text{B/W card 2}) + P(\text{B/B card 1})P(\text{white up card 2}|\text{B/B card 1},\text{W/W card 2})}{P(\text{black up card 1},\text{white up card 2})}$$$$=\frac{P(\text{B/B card 1})P(\text{white up card 2}|\text{B/B card 1},\text{B/W card 2}) + P(\text{B/B card 1})P(\text{white up card 2}|\text{B/B card 1},\text{W/W card 2})}{P(\text{B/B card 1})P(\text{B/W card 2, white up})+P(\text{B/B card 1})P(\text{W/W card 2, white up)}+P(\text{B/W card 1})P(\text{W/W card 2, white up)}}$$

2H1

I honestly found these hard questions in some ways easier than some of the medium ones above, because for the above questions I found a bit tricky to translate the words into the language of probability.

$$P(\text{twins}|A) = 0.1$$$$P(\text{single}|A) = 0.9$$$$P(\text{twins}|B) = 0.2$$$$P(\text{single}|B) = 0.8$$$$P(A) = P(B) = 0.5$$$$P(\text{next twins} | \text{last twins}) = \frac{P(\text{next twins},\text{last twins})}{P(\text{last twins})}$$

Assuming conditional independence of the first and second births being twins, given the species:

$$\frac{P(\text{twins}|A)P(A)P(\text{twins}|A) + P(\text{twins}|B)P(B)P(\text{twins}|B)}{\sum_{s \in species} P(\text{twins}|s)P(s)}$$

Substituting in the respective values:

2H2

$$P(A|\text{twins}) = \frac{P(A, \text{twins})}{P(\text{twins})}$$$$ = \frac{P(\text{twins}|A)P(A)}{\sum_{s \in species}P(\text{twins}|s)P(s))}$$

Substituting in the respective values:

2H3

$$P(A|\text{twins then single}) = \frac{P(A, \text{twins}, \text{single})}{P(\text{twins}, \text{single})}$$$$ = \frac{P(\text{twins}|A)P(\text{single}|A)P(A)}{\sum_{s \in species}P(\text{twins}|s)P(\text{single}|s)P(s))}$$

2H4

$$P(A_{test}|A) = 0.8$$$$P(B_{test}|A) = 0.2$$$$P(A_{test}|B) = 0.35$$$$P(B_{test}|B) = 0.65$$$$P(A|A_{test}) = \frac{P(A, A_{test})}{P(A_{test})}$$$$P(A|A_{test}) = \frac{P(A_{test}|A)P(A)}{\sum_{s\in species}P(A_{test}|s)P(s)}$$

Substituting in the respective values: