Geometric Bayesian Update

12 Post author: SquirrelInHell 09 April 2016 07:24AM

Today, I present to you Bayes theorem like you have never seen it before.

Take a moment to think: how would you calculate a Bayesian update using only basic geometry? I.e., you are given (as line segments) a prior P(H), and also P(E | H) and P(E | ~H) (or their ratio). How do you get P(H | E) only by drawing straight lines on paper?

Can you think of a way that would be possible to implement using a simple mechanical instrument?

It just so happens that today I noticed a very neat way to do this.

Have fun with this GeoGebra worksheet.

And here's a static image version if the live demo doesn't work for you:

 


Your math homework is to find a proof that this is indeed correct.

Hint: Vg'f cbffvoyr gb qb guvf ryrtnagyl naq jvgubhg nal pnyphyngvbaf, whfg ol ybbxvat ng engvbf bs nernf bs inevbhf gevnatyrf.

Please post answers in rot13, so that you don't spoil the fun for others who want to try.


Edit: For reference, here's a pictograph version of the diagram that came up later as a follow-up to this comment.

Comments (9)

Comment author: Good_Burning_Plastic 09 April 2016 08:36:34AM 4 points [-]

There's no reason why P(E|H) and P(E|~H) must sum to 1, but I can't move the lower right corner without the whole diagram rescaling.

Comment author: SquirrelInHell 09 April 2016 08:50:52AM *  3 points [-]

Of course you are right, but it would just be a linear transformation of the whole diagram, so it doesn't change anything in the result. I've built the diagram starting from a square, so I can't change this easily... just imagine the whole thing scaling on the X axis, OK?

Edit: since two people asked for this, I remade the diagram and now you can put in any values of P(E|H) and P(E|~H)

Comment author: AlexMennen 09 April 2016 05:34:07PM *  0 points [-]

When I drag the dot for P(E|~H), it only changes P(E|~H), but when I drag the dot for P(E|H), it still keeps P(E|H)+P(E|~H) conserved, which is a little weird. I think it would be better if changing either of them did not affect the other.

Comment author: Petter 09 April 2016 10:28:20AM 1 point [-]

Agreed. The diagram strongly suggests that they do sum to one, so this geometrical method is more confusing than helpful.

Comment author: gjm 11 April 2016 01:10:23PM 0 points [-]

Two-word proof: Prin'f gurberz. (Nebhaq gur gevnatyr, plpyvpnyyl, jr unir: rivqrapr, cevbe bqqf, erpvcebpny cbfgrevbe bqqf.)

I think this would be clearer with only the triangle where all the action is happening, and without the stuff on the left whose only job is to put the whole thing into a rectangle. You can still have the prior odds and the evidence on perpendicular axes: make it a right-angled triangle and let what's now the right-hand edge of the rectangle turn into the diagonal.

Comment author: SquirrelInHell 12 April 2016 01:34:39AM *  0 points [-]

the stuff on the left whose only job is to put the whole thing into a rectangle.

You are forgetting that it makes it possible to keep the scale of all numerical input/outputs consistent.

Comment author: gjm 12 April 2016 08:38:21AM 0 points [-]

Point taken. (I personally prefer odds ratios strongly enough for this kind of thing that keeping the scale consistent doesn't bother me.) You could fix that, kinda, by fixing the side lengths of the "prior" and "posterior" side while allowing the length of the "evidence" side to vary, but that means introducing extra not-so-visible constraints so maybe it's a bit of a cheat.

Comment author: ike 10 April 2016 01:19:30AM 0 points [-]

Not a proof:

Gur boivbhf ohg oehgr sbepr jnl gb qb guvf jbhyq or svaqvat gur rdhngvba bs gur gjb yvarf sebz gur gjb evtug pbearef (obgu rnfl orpnhfr bs fvzvyne gevnatyrf naq/be xabja yratguf/pbbeqvangrf), svaq gur cbvag jurer gurl vagrefrpg, jevgr gur rdhngvba sbe gur yvar cnffvat guebhtu vg naq gur ybjre yrsg pbeare, fbyir sbe gung yvar uvggvat gur evtug yvar, gura fvzcyvsl. V unira'g qbar vg, ohg guvf fubhyq onfvpnyyl jbex qverpgyl.

Vf gurer fbzr oevyyvnag jnl bs fubjvat vg ol zrer fvzvynevgvrf? V qvqa'g frr bar vzzrqvngryl.

Comment author: SquirrelInHell 10 April 2016 01:48:50AM 0 points [-]

I've added a hint in the main post.