The power of Bayes


Hello RTU followers!

I was thinking over topics I had never written on, and one of the things that immediately sprung to mind was statistics. This may strike some as odd, since it lies at the heart of modern physics however there is a good and simple reason for this: myself and Mekhi don’t enjoy it as much. Given the broad reach of modern science, I think it is permissible to still say you love science whilst not enjoying an area of it, but in the interests of personal betterment we shall banish the elephant from the room.

In fairness todays topic is quite interesting – we will talk about Bayes Theorem, the work of Rev. Thomas Bayes, who died in 1761 of one of those generic illnesses people seemed to die of in times of poorer sanitation. Bayes Theorem initially seems like a probability tool – however it is much more than that, it gives a way of thinking which I believe to be incredibly healthy – this is what gives it a broader appeal making it worthy of a slot on the blog. Those of you who regularly watch the Big Bang Theory my have even spotted Bayes Theorem making a cameo – which hopefully gives some evidence to suggest this is a big popular area in modern science, rather than some niche bit of stats I decided to torture the readers with.


Some simple, slightly dry ideas

In order to appreciate the appeal of Bayes, you need to first understand roughly how it works. Bayes Theorem is presented in a 15,000 word essay, so there are a lot of different themes to it, but the theme is events and evidence.

A fundamental point to consider is that a test and an event are discrete things. In the example we are going to build we will have an event, which is going to be me falling severely ill with a rare disease. Because I don’t want this to happen, we have come up with a test to check for the illness – which is to take my blood pressure and see if it is highly elevated above a certain threshold. The test isn’t exactly perfect – there are many things which can highly elevate my blood pressure, from a stressful day at work to several coffees so the test could incorrectly diagnose me as severely ill (a false positive). It is also possible, although less likely, that there is another factor lowering my blood pressure on the very same day that gives me a negative reading when I am severely ill, say I have just come back from a relaxing holiday to Rome – this would be a false negative.

I’m sure by now you are screaming GIVE ME SOME NUMBERS, because truthfully you can’t explain as efficiently with words. If I am actually ill, there is a 90% chance that the test will read positive – the other 10% of the time, this is the false negative we spoke about, where my blood pressure has been lowered for another reason. On the other side if I were perfectly well then the test will read negative 95% of the time. There is still a 5% chance that the test reads positive even though I am fine. Clearly we can draw from this is that the test probabilities are not real – there are so many factors which can influence the tests that we must make a distinction between the real probabilities and the test probabilities. The real probabilities do exist, and are features of the universe. The test probabilities will be closer to the real probabilities if we can refine our blunt human instruments. In this example, we are rolling with a 1% chance that I am severely ill, and a 99% chance that I am not. All of these probabilities are pretend.

Joe Ill (1%) Joe Well (99%)
Test Positive 90% 5%
Test Negative 10% 95%

From this table we see that I have a 1% chance of actually being ill, but that does not tell me if I am actually ill or not – I know the probability of having any disease but it still does not tell me if I have it… Only a test can tell me that and tests are flawed.  So the question really is – how good is this test, given the presence of these false negatives? If my test is positive – how worried should I be? The test does not seem that bad, given if I am ill it gets it right 90% of the time. We do some analysis on the table – without getting too mathematical, to combine the probability of two events you multiply them. So if the chance of flipping a coin to heads is 50%, the probability of two heads in a row is 25% – which I can write as 0.5 x 0.5 = 0.25. Here I combine the probability for each event considering the probabilities I am actually ill using the real probabilities.

Joe Ill (1%) Joe Well (99%)
Test Positive The True Positive

0.01 x 0.9 = 0.009

The False Positive

0.99 x 0.05 = 0.0495

Test Negative The False Negative

0.01 x 0.1 = 0.001

The True Negative

0.99 x 0.95 = 0.9405

Next I am going to drop Bayes theorem, which will frighten you, then I will explain it and you will see it is quite cute.


Pr(A|X) means probability of A given X; so here we could say the probability of me being ill (A) given a positive test result, X.

Then we have Pr(X|A)Pr(A) which is quite simple – it’s the probability of X given A, multiplied by the probability of A. So if this is the probability of a positive result, given me being ill multiplied by the probability of me being ill. You can see this result in the top left hand corner, which I have made bold for your convenience. Then what we have  it is just “everything” else that could happen given the positive test result – the probability that I am ill given a positive test result multiplied by the probability of being ill, plus the probability of not being ill given a positive test result multiplied by the probability of not being ill. Those words may seem like a total mess – that’s why we use symbols in mathematics, once you know how to read them life is better.

What is the actual answer? If you crunch the numbers you get 15.4% – what this is saying is that the probability of actually being ill given a positive test result is 15.4%. If that seems obvious to you, then you are a better statistician than me. If it seems a little at odds with what I said earlier, then such is Bayes and why it is so important to run the numbers. The reason that this is so is due to the fact the event itself, me being ill, is so rare. Don’t get lured in by the silly human tests – the real probability was 1%. So even though the test gives the correct result given be being ill 90% of the time, it is so rare that I actually am ill that the false positives occur a lot more. Because there is so much room for false positive results, even after a positive result from the test I am probably fine. Pretty dumb test it seems.

Well done, you stuck with the statistics. I didn’t like writing it and you didn’t enjoy reading it, but let us reward ourselves with something which is quite neat.

Some deeper, juicy ideas

The above is a method that you can compute the probability of something given an event, which is useful. It teaches us interesting things about the crude nature of our tests, and highlights how false positives or negatives can render tests almost useless – in the sense that you can’t even rely on the result. What is really interesting is how Bayes theorem can be used for so many tasks – it can (and does) sort spam emails, help robots to learn and even help you to decide things in your own mind. It is believed that your brain employs many different Baysean algorithms without you even realizing (so you kind of know a lot of this already!).

The power in Bayes Theorem comes from using the best available evidence we have, and then using it to update our belief system – this is highly scientific. In the above example, if we had a positive result we now know that I have a 15% chance of actually being ill. This is far different to the situation we started in, when we were doing a test with a 1% chance of me being ill. If we were to run the test again we could perform the same calculations but instead of the 1% we have 15% – now, assuming the same positive result in the test as the one we had before we can now be 76% sure that I am ill. So by running the test twice, a test which is highly flawed, it becomes much more useful. We would only need to do this test once, or maybe two more times with a positive result before we were comfortable enough to start treatment. This is a much better way of diagnosing people, although it comes with an economic cost. What we have done is powerful – we are only doing the same test over and over, but rather than looking at them in isolation we continually update our belief system to become more confident in our assertions.

You might be forgiven for thinking by this point – hang on this just feels like common sense. I hope you do, because Bayes theorem is just that, a codification of common sense but we can use it to find the truth. Bayes theorem tells us that if people are willing to play the game, we can find the truth about the whole universe – it will always win out. Take the big question, God. Richard for example, who often engages in lively discussion here at RTU firmly believes in God, where as I firmly do not. Neither of us actually have any probabilities God exists, except for the ones we have decided. These are our prior credences. If we both played the game and collected evidence, we could keep updating our belief system in the method of Bayes. We take our prior credence, that God does or does not exist and the probability of it, and then take some evidence/event (say for example a scientific discovery that seems to contradict a holy scripture) and update our beliefs. We would need to understand (in our own minds) how likely is it that this indicator is actually a false positive or negative – just like we did in our example above, so say for example the scientific discovery were actually wrong – since this itself is just based on tests. We update our belief system, and we both have a slightly different view of the world – I maybe am firmer in my belief, or less firm depending on the example and we may have moved our beliefs by different amounts, however if we are being honest we will both be closer in our views.

It all depends on prior credences about certain events and pieces of evidence, coupled with a truly honest refreshing of our belief system. There is a deep philosophical message here, that if you are not thorough about seeking and considering all explanations for your evidence, the truth will be hidden from you and your evidence will only serve to confirm your prejudice. Search for evidence widely, consider all options thoroughly and update your prior credences with untapped honesty and be rewarded with the truth. This is what it’s all about – this is how we decide if God is real, determine if there is a multiverse, if string theory is real or conduct medical testing as we saw earlier! This is the definitive way to think if you want to arrive at the truth.

An additional beauty in this theorem, is the change in direction from Popper’s falsifiability criteria – it means we can consider big theories we cannot falsify and make progress in determining if they are true without dying some big scientific death. Non-falsifiable? No issue – we can just run the Bayes method and get closer and closer to the truth.

I must remind you that with great power, comes great responsibility. If this logic is abused you will arrive at the wrong conclusions. Many humans for example have emotions – they want things to be true and they are unwilling to update their credences in the way that they should. Desperately wanting there to be a heaven does not lend itself well to openly considering all options, which will mean that Bayes theorem will not work and we will confirm our prejudices as discussed. People don’t rigorously consider all alternatives which means that their tests don’t have a complete view of the world. Perhaps saddest of all, since it is hardest to get around, sometimes peoples views are just so polarised and the evidence available is so sparse that a human lifetime is far too short to give enough plays of the game to reveal the truth. This is why it is of vital importance that you learn all the lessons past on from our ancestors, and contribute our own tests to the pot to update the credences of those who call us their ancestors.

The search for the truth is bigger than me, you or any of us. So do the right thing and be a good Baysian, update your credences and pass it on for the good of humanity. A fascinatingly simple embodiment of common sense, that pokes around in some very deep pockets of thought.

Read it at the source


Leave A Reply

Skip to toolbar