Sunday, January 30, 2022

Excuse me Brother, have you let the Reverend Bayes into your life?

The Onion spoke wisely:


https://www.theonion.com/cdc-announces-plan-to-send-every-u-s-household-pamphle-1848354068


And in response someone on reddit said:


Can you share an example of the way it changed your worldview? I did not experience a similar perspective shift when learning the same material, and I'm curious if there's something I've missed out on.


To which my reply was:

 

Principally for me the idea that there can be several possible underlying explanations for a thing, and that rather than choosing one, you should keep them all in mind, and shift credibility around amongst them as evidence comes in.

E.g. what am I rolling? 6 3 2 1 7 3 3 2 .....

What will you bet, and at what odds?

 

This then attracted the (very good) reply:


1 shows you're rolling a single die, 7 shows it has at least more than 6 faces, assuming a standard polyhedral die it has to be at least a d8 but with no result higher than a 7 it is extremely unlikely to be a d20 and somewhat unlikely to be a d12 (although that is far to short a sequence to be certain) so I would bet it's a d8... at what odds, without breaking out my calculator I'd say its 75% d8 22% d12 3% d20

Which to my mind shows exactly the sort of thinking that I think is the major benefit of learning a bit of Bayes.

So at that point I felt that it would be nice to give my own fully worked out answer to the question:

(which is just completely the obvious answer so if you can already do this, don't bother reading it or do it yourself and see if you agree with me)

 

 


Your reasoning is bang on, well done!

Since I asked the question and you've taken the trouble, my answer would be:

You can't do inference without making assumptions. So:

Start off assuming I've got one of each of the five polyhedra, and their faces are numbered 1..n, (call them d4, d6, d8, d12, d20) and I've chosen one at random.

Then our prior is [1,1,1,1,1] 20% chance of each die.

When we see a six, that rules out the d4, multiply its number by 0/4
All the others could have done this, so they get multiplied by 1/6,1/8,1/12,1/20, which are their chances of rolling a 6.

[0,1/6,1/8,1/12,1/20], so we already think that the d6 is about three times more likely than the d20

3,2,1 are all possible rolls for all the remaining dice, so the odds update similarly on each roll, going from [0,1/6,1/8,1/12,1/20] to:

[0,1/6^2,1/8^2,1/12^2,1/20^2]
[0,1/6^3,1/8^3,1/12^3,1/20^3]
[0,1/6^4,1/8^4,1/12^4,1/20^4]

d6 is looking very likely now, d20 almost ruled out at something like 100:1

Now we see a 7, which is quite surprising! As you pointed out, that rules out the d6, leaving our odds:

[0,0,1/8^5,1/12^5,1/20^5]

d8 now has most of the remaining probability

3,3, and 2 give us no more surprises, so we're at

[0,0,1/8^8,1/12^8,1/20^8]

At this point I resort to python as a desk calculator:
>>> a=[pow(8,-8),pow(12,-8),pow(20,-8)]
>>> [x/sum(a) for x in a]

[0.9618401442621229, 0.037529504180933315, 0.0006303515569436249]

We got about a 96% chance of a d8. about a one in thirty chance of a d12, d20 is almost ruled out.

Of course at that point, most of the uncertainty is in our model. 

What if I'd had a d10? What if I'd had a d6 with the faces numbered 2..7? What if I was rolling 3d6? What if I really like the d12 and use it much more often than the others?

It's not too hard to add those possibilities into the model, with appropriate starting guesses for their probabilities, and see what the evidence does to them as it comes in.

 




This kind of thinking was a revelation to me when I first saw it. Now it's the background to almost everything I think about.

Latest interesting question is: Was Covid-19 a lab leak?

Just phrasing the question in this sort of framework leads to a really obvious conclusion, and also shows that it doesn't really matter!



No comments:

Post a Comment

Followers