2. Diagnose the problem.

Use Bayesian inference

By January 9, 2015 No Comments

“When the facts change, I change my opinion. What do you do, sir?” — John Maynard Keynes

In many situations, we don’t follow Keynes’ approach. In fact, in light of new evidence, we usually don’t update our initial beliefs as much as we should. Bayesian inference can help.

Specifically, Bayesian inference allows you to revise the likelihood of a hypothesis h (the prior) in light of a new item of evidence to get to a posterior. The posterior P(h|d) equals your prior P(h)times the conditional probability of the datum of evidence P(d|h) given the hypothesis divided by the probability of the evidence P(d). That is,

Bayes’ rule

It may look scary but it isn’t as bad as it looks. Here’s an example.

Bayesian inference, a very short introduction

Facing a complex situation, it is easy to form an early opinion and to fail to update it as much as new evidence warrants.

Consider Tversky and Kahneman famous example:

“A cab was involved in a hit and run accident at night. Two cab companies, the Green and the Blue, operate in the city. You are given the following data:

a. 85% of the cabs in the city are Green and 15% are Blue.

b. A witness identified the cab as Blue. The court tested the reliability of the witness under the same circumstances that existed on the night of the accident and concluded that the witness correctly identified each one of the two colors 80% of the time and failed 20% of the time.

What is the probability that the cab involved in the accident was Blue rather than Green knowing that this witness identified it as Blue?”

(Tversky and Kahneman, 1982 [pp. 156–157])

Here, we are interested in the probability of the cab being Blue (this is our hypothesis, h: cab is blue) given that it was identified as blue (this is our datum, d: seen as blue): P(Cab is Blue|Seen as Blue). To use the equation above, we need three  pieces of data:

  1. The prior probability of the cab being blue, which is given to us by the base rate: P(Cab is Blue)=0.15 (or 15%)
  2. The probability that the cab was seen as blue when it was indeed blue, which is given to us by the court’s reliability test: P(Seen as Blue|Cab is Blue)=0.80
  3. The probability that the cab was seen as blue: that’s equal to the probability that it is seen as blue when it is blue + the probability that it is seen as blue when, in fact, it is green; i.e., P(d)=(0.80)x(0.15) + (0.20)x(0.85)=0.29

So, we can now calculate the posterior: P(Cab is Blue|Seen as Blue) = (0.15)x(0.80)/(0.29)=0.41 or 41%.

That is, even though the witness identified the cab as blue, it is more likely that it was green.

The take away is that, when testing a diagnostic hypothesis, chances are that after you form an opinion you do not change it as much as disconfirming evidence warrants you to (this is a form of confirmation bias; see, for instance, Nickerson, 1998). Using Bayesian inference may help you update your thinking in a more rational way.


Nickerson, R. S. (1998). “Confirmation bias: a ubiquitous phenomenon in many guises.” Review of General Psychology 2(2): 175.

Tversky, A. and D. Kahneman (1982). Evidential impact of base rates. Judgment Under Uncertainty: Heuristics and Biases. D. Kahneman, P. Slovic and A. Tversky. New York, Cambridge University Press.

Also, for an introduction to Bayesian inference, see: McGrayne, S. B. (2011). The theory that would not die: how Bayes’ rule cracked the enigma code, hunted down Russian submarines, & emerged triumphant from two centuries of controversy, Yale University Press.

Leave a Reply