Is my dime fair?

I made my one trip to the United States in November 2009 – four days in Washington DC (three working, one extra day’s holiday). It was a fantastic experience and I hope to go again, soon.

I brought back a dime (10 cent coin) from that trip and tonight decided to test it for its fairness as a tossing coin (really, I am working through an example from Data Analysis: A Bayesian Tutorial, and as I write this I do not know what the answer will be.)

I tossed the coin ten times and (taking FDR’s bust as the head, h, and liberty, peace and victory as the tails, t), I got this sequence thththhhhh. So 70% of the tosses resulted in a head – too many to suggest the coin is fair? Let’s see.

I am going to use this formula, based on Bayes’s theorem:

pdf(H \vert \{data\},I) \propto pdf(\{data\} \vert H,I) \times pdf(H \vert I)

In other words the probability density function (pdf) for bias (H = 0 is a double tailed coin, H = 0.5 is a perfectly fair coin, H = 1 is a double headed coin) is proportional to the products of the observed data and the initially guessed (prior) pdf for H (in all cases I means the other, initial, conditions in the universe).

I begin with stipulating I know nothing about the coin’s bias, in other words set the prior pdf to 1 for all possible values of H. After two tosses we know that the probability of H = 1 is zero and similarly the probability of H = 0 is also zero. But what of the other values for H.

Well, \int_0^1HdH = 1 but we ignore that just to look at the relative values.

The data pdf is governed by the binomal distribution \propto H^R(1-H)^{N-R} where N is the total number of tosses and R is the number of heads returned.

So for H = 0.1 we get 0.1^1 \times 0.9^ 1 = 0.09, H = 0.2 0.2^1 \times 0.8^1 = 0.16, H = 0.3 0.3 \times 0.7 = 0.21 , H = 0.4 0.4 \times 0.6 = 0.24 , H = 0.5 0.5 \times 0.5 = 0.25 . The results are obviously symmetrical about 0.5, and as the prior pdf is 1 for all values of H, we can say that the most likely view is that the coin is fair but we have a high degree of uncertainty (see graph)

pdf after one head, one tailSo, now we toss an additional tail and take the new pdf (as in the graph) as our prior – what do we get now.

Well for H = 0.1 we now get for the data (0.1)^1 \times (0.9)^2 = 0.081 which we multiply by our new prior of 0.09 to get 0.00729. For H = 0.2 this becomes (0.2)^1 \times (0.8)^2 \times 0.16 = 0.02048 (of course the actual numbers mean little here, we are merely tracing the shape of the graph). In contrast H = 0.8 would now give (0.8)^1 \times (0.2)^2 \times 0.16 = 0.00512. The new graph has the shape shown below:

pdf shape after two tails and one headThis coin may be biased but there is still a lot of uncertainty here…

As it’s now after 12.30 in the morning here the rest will have to wait…



One response to “Is my dime fair?”

%d bloggers like this: