BDA3 Chapter 2 Exercise 2

Here’s my solution to exercise 2, chapter 2, of Gelman’s Bayesian Data Analysis (BDA), 3rd edition. There are solutions to some of the exercises on the book’s webpage.

We are given the following information about the two coins.

p(C1)=0.5p(HC1)=Bernoulli(H0.6)p(C2)=0.5p(HC2)=Bernoulli(H0.4)

The posterior probability of each coin given two tails is:

p(C1TT)p(TTC1)p(C1)=(25)212=225

p(C2TT)p(TTC2)p(C2)=(35)212=950

Both of the previous probabilities are normalised by the same constant. Since p(C1TT)+p(C2TT)=1, the normalising constant is 225+950=1350. Thus

p(C1TT)=413andp(C2TT)=913.

Let y be the number of additional spins until the next head. Conditional on a coin, y is geometrically distributed. So the expected number of spins before the next head is:

E(yTT)=413E(yC1)+913E(yC1)=41353+91352=2039+4526=17578,

which is 2.24359.