Statistical Rethinking: Chapter 3 Practice Answers

Note that the answers here might not be exactly in line with what is in the book, since the samples there come from R code.

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

3E1

In the book a seed is set so the samples can be replicated exactly. I guess we could run R and get the exact correct samples.

3E2

3E3

3E4

3E5

3E6

3E7

3M1

3M2

3M3

3M4

3M5

3M6

Looks like somewhere between 2200 and 2400 tosses will result in an interval width of 0.05.

Hard

3H1

3H2

3H3

Yes, this posterior predictive plot seems to make the observed data very likely.

3H4

The actual data observed just from birth1 is not a very central, likely outcome according to the model estimated over all the births. We can conclude that birth1 and birth2 datapoints come from different distributions.

3H5

Surprisingly, of the 49 cases where the first birth was a girl, 39 of them were followed by a boy! This can't be right, as it suggests the births are not IID. Somehow a birth being a girl makes it more likely the next one will be a boy.

We're seeing that the number of boys in the first birth is roughly equal to that of the number of girls, but in the second birth, boys are far more common.

My hypothesis is that the first child is accepted by the parents regardless of gender, but that cultural pressure to have boys results in frequent infanticide if more than one girl is born. The infanticide is kept secret, so those latent girl births (that are in fact I.I.D) are never recorded.