Thursday, 24 November 2011

Maths and the Real World: Bayes' Theorem

Bayes' Theorem is one of the most practical theorems to apply to everyday life and if used correctly it can be an indispensable decision making tool. In a nutshell what the Bayes' Theorem does is measure the confidence that something is true. It takes the uncertainty before and after observing the modelled system and links the two.


We shall use an example to help explain what the Bayes' Theorem is and how it works. Let's consider the example that you have had a persistent headache for a week now and you're not certain what the cause it. But you do believe that it is caused either by stress (hypothesis A) or by having caffeine (hypothesis B).


So to test if stress is the key to the chronic headaches you have a day of relaxation whilst you've got a headache and have had coffee on the same day. By the end your headache has gone, so this can be considered as evidence. This should have some relation to how much more likely is A than B. But how strong is this evidence exactly? And how do we show which hypothesis it supports? Bayes' Theorem tells us that these answers lie in what is called the Bayes' Factor.


The Bayes' Factor is the question: "How much more likely would it be for this evidence to occur if A were true than if B were true?". This question must lead to one of three conclusions:


  1. The evidence would be more likely to occur if A were true than if B were true. This means that the evidence supports A rather than B.
  2. The evidence would be just as likely to occur if A or B were true. This means that the evidence has no real weight to whether A or B is more likely to be correct. That means that the "evidence" is not actually evidence at all.
  3. The evidence would be more likely to occur if B were true than if A were true. This means that the evidence supports B rather than A.
In our example of chronic headaches the Bayes' factor becomes: "How much more likely would it be for the headache to disappear after having a day of relaxation if stress were the cause compared to if caffeine was the cause?".


Now we do do not know the precise answer to this, but we can give a rough approximation to it. A day of relaxation could have some effect at stopping a headache if caffeine was the cause, but it shouldn't have too much of an effect, no more than a 1 in 5 chance for a persistent headache. On the other hand if the factor of stress is dealt with and the headache disappears, that is a pretty good indication that stress is the key cause, so the chances that stress is the main cause is about 1 in 2.


How likely the headache would have stopped given A is 1/2. How likely the headache would have stopped given B is 1/5. Hence the Bayes' factor, how likely would it be for the headache to stop given A compared to how likely it was to stop given B, is at least (1/2) / (1/5) = 2.5.


This means that given our evidence we should now believe that A is at least 2.5 times more likely compared to B, this is compared to what we used to think. The Bayes' factor tells us how much more our new evidence should cause us to believe the likelihood of one of our hypotheses.


Now let's suppose that you already suspected that stress was twice as likely to be the main cause (as you had recently taken on more responsibility causing more stress). Now we know that the Bayes' Factor is at that A is at least 2.5 times more likely than B, but as we already believe A to be twice as likely as B we know that A is now at least 5 times more likely than B.


Bayes' Theorem is useful because it tells us the correct sort of question to ask ourselves and then it uses maths and statistics to provide us with a suitable answer and easy to understand conclusion. Bayes' Theorem can also provide an answer when looking at just one variable, you simply change B to to A' (not A).


However as humans we tend to have a very poor ability at distinguishing what is or isn't evidence. If we're expecting a particular result we're far more likely to apply whatever evidence we've got and assess it with bias.


So the important part of interpreting the evidence we now have is to always use the question "How much more likely would it be for this evidence to occur if A were true than if B were true?". In the next post I do I will be writing about the maths behind Bayes' theorem.

No comments:

Post a Comment