# The bean machine

Take a look at the following video…

It shows the operation of a mechanical device that is variously known as a bean machine, a quincunx or a Galton board. When the machine is flipped, a large number of small balls or beans fall through a funnel at the top of the device. Below the funnel is a layered grid of pegs. As each bean hits a peg it can fall left or right – with equal probability if the board is carefully made – down to the next layer, where it hits another peg and can again go left or right. This repeats for a number of layers, and the beans are then collected in groups, according to the position they fall in the final layer. At the end you get a kind of physical histogram, where the height of the column of beans corresponds to the frequency with which the beans have fallen in that slot.

Remarkably, every time this experiment is repeated, the pattern of beans at the bottom is pretty much the same: it’s symmetric, high in the middle, low at the edges and has a kind of general bell-shape. In fact, the shape of this histogram will be a good approximation to the well-known normal distribution curve:

As you probably know, it turns out that the relative frequencies of many naturally occurring phenomena look exactly like this normal curve: heights of plants, people’s IQ, brightness of stars…. and indeed (with some slight imperfections) the differences in team points in sports like basketball.

Anyway, if you look at the bottom of the bean machine at the end of the video, you’ll see that the heights of the columns of beans – which in itself represents the frequency of beans falling in each position – resembles this same bell-shaped curve. And this will happen – with different small irregularities – every time the bean machine is re-started.

Obviously, just replaying the video will always lead to identical results, so you’ll have to take my word for it that the results are similar every time the machine is operated. There are some simulators available, but my feeling is you lose something by not seeing the actual physics of real-world beans falling into place. Take a look here if you’re interested, though I suggest you crank the size and speed buttons up to their maximum values first.

But why should it be that the bean machine, like many naturally occurring phenomena, leads to frequencies that closely match the normal curve?

Well, the final position of each bean is the result of several random steps in which the bean could go left or right. If we count +1 every time the bean goes right and -1 every time the bean goes left, then the final position is the sum of these random +/-1 outcomes. And it turns out, that under fairly general conditions, that whenever you have a process that is the sum of several random experiments, the final distribution is bound to look like this bell-shaped normal curve.

This is a remarkable phenomenon. The trajectory of any individual bean is unpredictable. It could go way to the left, or way to the right, though it’s more likely that it will stay fairly central. Anything is possible, though some outcomes are more likely than others. However, while the trajectory of individual beans is unpredictable, the collective behaviour of several thousand beans is entirely predictable to a very high degree of accuracy: the frequencies within any individual range will match very closely the values predicted by the normal distribution curve. This is really what makes statistics tick. We can predict very well how a population will behave, even if we can’t predict how individuals will behave.

Even more remarkably, if the bean machine has enough layers of pegs, the eventual physical histogram of beans will still look like the normal distribution curve, even if the machine has some sort of bias. For example, suppose the beans were released, but that the machine wasn’t quite vertical, so that the beans had a higher tendency to go left, rather than right, when they hit a peg. In this case, as long as there were sufficiently many layers of pegs, the final spread of beans would still resemble the normal curve, albeit no longer centred at the middle of the board. You can try this in the simulator by moving the left/right button away from 50%.

Technically, the bean machine is a physical illustration of a mathematical result generally termed the Central Limit Theorem. This states that in situations like those illustrated by the bean machine, where a phenomenon can be regarded as a sum of random experiments, then under general conditions the distribution of final results will look very much like the well-known bell-shaped normal curve.

It’s difficult to overstate the importance of this result – which is fundamental to almost all areas of statistical theory and practice – since it lets us handle probabilities in populations, even when we don’t know how individuals behave. And the beauty of the bean machine is that it demonstrates that the Central Limit Theorem is meaningful in the real physical world, and not just a mathematical artefact.

Can’t live without your own desktop bean machine? I have good news for you…

# Pulp Fiction (Our Esteemed Leader’s cut)

The previous post had a cinematic theme. That got me remembering an offsite a while back where Matthew.Benham@smartbapps.co.uk gave a talk that I think he called ‘Do the Right Thing’, which is the title of a 1989 Spike Lee film. Midway through his talk Matthew gave a premiere screening of his own version of a scene from Pulp Fiction. Unfortunately, I’ve been unable to get hold of a copy of Matthew’s cut, so we’ll just have to make do with the inferior original….

The theme of Matthew’s talk was the importance of always acting in relation to best knowledge, even if it contradicts previous actions taken when different information was available. So, given the knowledge and information you had at the start of a game, you might have bet on team A. But if the game evolves in such a way that a bet on team B becomes positive value, you should do that. Always do the right thing. And the point of the scene from Pulp Fiction? Don’t let pride get in the way of that principle.

These issues will make a great topic for this blog sometime. But this post is about something else…

Dependence is a big issue in Statistics, and we’re likely to return to it in different ways in future posts. Loosely speaking, two events are said to be independent if knowing the outcome of one, doesn’t affect the probabilities of the outcomes of the other. For example, it’s usually reasonable to treat the outcomes of two different football matches taking place on the same day as independent. If we know one match finished 3-0, that information is unlikely to affect any judgements we might have about the possible outcomes of a later match. Events that are not independent are said to be dependent: in this case, knowing the outcome of one will affect the outcome of the other.  In tennis matches, for example, the outcome of one set tends to affect the chances of who will win a subsequent set, so set winners are dependent events.

With this in mind, let’s follow-up the discussion in the previous 2 posts (here and here) about accumulator bets. By multiplying prices from separate bets together, bookmakers are assuming that the events are independent. But if there were dependence between the events, it’s possible that an accumulator offers a value bet, even if the individual bets are of negative value. This might be part of the reason why Mark Kermode has been successful in several accumulator bets over the years (or would have been if he’d taken his predictions to the bookmaker and actually placed an accumulator bet).

Let me illustrate this with some entirely made-up numbers. Let’s suppose ‘Pulp Fiction (Our Esteemed Leader’s cut)’, is up for a best movie award, and its upstart director, Matthew Benham, has also been nominated for best director. The numbers for single bets on PF and MB are given in the following table. We’ll suppose the bookmakers are accurate in their evaluation of the probabilities, and that they guarantee themselves an expected profit by offering prices that are below the fair prices (see the earlier post).

True Probability Fair Price Bookmaker Price
Best Movie: PF 0.4 2.5 2
Best Director: MB 0.25 4 3.5

Because the available prices are lower than the fair prices and the probabilities are correct, both individual bets have negative value (-0.2 and -0.125 respectively for a unit stake). The overall price for a PF/MB accumulator bet is 7, which assuming independence is an even poorer value bet, since the expected winnings from a unit stake are

$0.4 \times 0.25 \times 7 -1 = -0.3$

However, suppose voters for the awards tend to have similar preferences across categories, so that if they like a particular movie, there’s an increased chance they’ll also like the director of that movie. In that case, although the table above might be correct, the probability of MB winning the director award if PF (MB cut) is the movie winner is likely to be greater than 0.25. For argument’s sake, let’s suppose it’s 0.5. Then, the expected winnings from a unit stake accumulator bet become

$0.4 \times 0.5 \times 7 -1 = 0.4$

That’s to say, although the individual bets are still both negative value, the accumulator bet is extremely good value. This situation arises because of the implicit assumption of independence in the calculation of accumulator prices. When the assumption is wrong, the true expected winnings will be different from those implied by the bookmaker prices, potentially generating a positive value bet.

Obviously with most accumulator bets – like multiple football results – independence is more realistic, and this discussion is unhelpful. But for speciality bets like the Oscars, or perhaps some political bets where late swings in votes are likely to affect more that one region, there may be considerable value in accumulator bets if available.

If anyone has a copy of Our Esteemed Leader’s cut of the Pulp Fiction scene on a pen-drive somewhere, and would kindly pass it to me, I will happily update this post to include it.

# How to not win ￡194,375

In the previous post we looked at why bookmakers like punters to make accumulator bets: so long as a gambler is not smart enough to be able to make positive value bets, the bookmaker will make bigger expected profits from accumulator bets than from single bets. Moreover, even for smart bettors, if any of their individual bets are not smart, accumulator bets may also favour the bookmaker.

With all this in mind, here’s a true story…

Mark Kermode is a well-known film critic, who often appears on BBC TV and radio. In the early 90’s he had a regular slot on Danny Baker’s Radio 5 show, discussing recent movie releases etc. On one particular show early in 1992, chatting to Danny, he said he had a pretty good idea of how most of the important Oscars would be awarded that year. This was actually before the nominations had been made, so bookmaker prices on award winners would have been pretty good and since Radio 5 was a predominantly sports radio station, Danny suggested Mark make a bet on the basis of his predictions.

Fast-forward a few months to the day after the Oscar awards and Danny asked Mark how his predictions had worked out. Mark explained that he’d bet on five of the major Oscar awards and they’d all won. Danny asked Mark how much he’d won and he replied that he’d won around ￡120 for a ￡25 stake.  Considering the difficulty in predicting five correct winners, especially before nominations had been made, this didn’t seem like much of a return, and Danny Baker was incredulous. He’d naturally assumed that Mark would have placed an accumulator bet with the total stake of ￡25, whereas what Mark had actually done was place individual bets of ￡5 on each of the awards.

Now, I’ve no idea what the actual prices were, but since the bets were placed before the nominations were announced, it’s reasonable to assume that the prices were quite generous. For argument’s sake, let’s suppose the bets on each of the individual awards  had a price of 6. Mark then placed a ￡5 bet on each, so he’d have made a profit of ￡25 per bet, for an overall profit of ￡125. Now suppose, instead, he’d made a single accumulator bet on all 5 awards. In this case he’d have made a profit of

$\pounds 25 \times 6 \times 6 \times 6 \times 6 \times 6 -\pounds 25 = \pounds 194,375$

Again, I’ve no idea if these numbers are accurate or not, but you get the picture. Had Mark made the accumulator bet that Danny intended, he’d have made a pretty big profit. As it was, he won enough for a night out with a couple of mates at the cinema, albeit with popcorn included.

Of course, the risk you take with an accumulator is that it just takes one bet to fail and you lose everything. By placing 5 single bets Mark would still have won ￡95 if one of his predictions had been wrong, and would even make a fiver if he got just one prediction correct. But by not accumulating his bets, he also avoided the possibility of winning ￡194,375 if all 5 bets came in. Which they did!

So, what’s the story here? Though an accumulator is a poor value bet for mug gamblers, it may be an extremely valuable bet for sharp gamblers, and the evidence suggests (see below) that Mark Kermode is sharper than the bookmakers for Oscar predictions.

Is Mark Kermode really sharper than the bookmakers for Oscar predictions? Well, here’s a list  of his predictions for the main 6 (not 5) categories for the years 2006-2017. Mark predicted all 6 categories with 100% accuracy twice in twelve years. I guess that these predictions weren’t always made before the nominations, so the prices are unlikely to be as good as in the example described above. But still, the price on a 6-fold accumulator will have been pretty good regardless. And he’d have won twice, in addition to the 1992 episode (and possibly more often in the intervening years for which I don’t have data). Remarkably, he would have won again in 2017 if the award for best movie had gone to La La Land, as was originally declared winner, rather than Moonlight, which was the eventual winner.

Moral: try to find out Mark’s predictions for the 2019 Oscars and don’t make the mistake of betting singles!

And finally, here’s Mark telling the story of not winning something like￡194,375 in his own words:

# Bookmakers love accumulators

You probably know about accumulator, or so-called ‘acca’, bets. Rather than betting individually on several different matches, in an accumulator any winnings from a first bet are used as the stake in a second bet.  If either bet loses, you lose, but if both bets win, there’s the potential to make more money than is available from single bets due to the accumulation of the prices. This process can be applied multiple times, with the winnings from several bets carried over as the stake to a subsequent bet, and the total winnings if all bets come in can be substantial. On the downside, it just takes one bet to lose and you win nothing.

Bookmakers love accumulators, and often apply special offers – as you can see in the profile picture above – to encourage gamblers to make such bets. Let’s see why that’s the case.

Consider a tennis match between two equally-matched players. Since the players are equally-matched, it’s reasonable to assume that each has a probability 0.5 of winning. So if a bookmaker was offering fair odds on the winner of this match, he should offer a price of 2 on either player, meaning that if I place a bet of 1 unit I will receive 2 units (including the return of my stake) if I win. This makes the bet fair, in the sense that my expected winnings – the amount I would win on average if the game were repeated  many times – is zero. This is because

$(1/2 \times 2) + (1/2 \times 0) -1 = 0$

That’s the sum of the probabilities multiplied by the prices, take away the stake.

The bet is fair in the sense that, if the match were repeated many times, both the gambler and the bookmaker would expect neither to win nor lose. But bookmakers aren’t in the business of being fair; they’re out to make money and will set lower prices to ensure that they have long-run winnings. So instead of offering a price of 2 on either player, they might offer a price of 1.9. In this case, assuming gamblers split their stakes evenly across two players, bookmakers will expect to win the following proportion of the total stake

$1-1/2\times(1/2 \times 1.9) - 1/2\times (1/2 \times 1.9)=0.05$

In other words, bookmakers have a locked-in 5% expected profit. Of course, they might not get 5%. Suppose most of the money is placed on player A, who happens to win. Then, the bookmaker is likely to lose money. But this is unlikely: if the players are evenly matched, the money placed by different gamblers will probably be evenly spread between the two players. And if it’s not, then the bookmakers can adjust their prices to try to encourage more bets on the less-favoured side.

Now, in an accumulator bet, the prices are multiplied. It’s equivalent to taking all of your winnings from a first bet and placing them on a second bet. Then those winnings are placed on the outcome of a third bet, and so on. So if there are two tennis matches, A versus B and C versus D, each of which is evenly-matched, the fair and actual prices on the accumulator outcomes are as follows:

Accumulator Bet A-C A-D B-C B-D
Fair Price 4 4 4 4
Actual Price 3.61 3.61  3.61 3.61

The value 3.61 comes from taking the prices of the individual bets, 1.9 in each case, and multiplying them together. It follows that the expected profit for the bookmaker is

$1-4\times 1/4\times(1/4 \times 3.61) = 0.0975$.

So, the bookmaker profit is now expected to be almost 10%. In other words, with a single accumulator, bookmakers almost double their expected profits. With further accumulators, the profits increase further and further. With 3 bets it’s over 14%; with 4 bets it’s around 18.5%. Because of this considerable increase in expected profits with accumulator bets, bookmakers can be ‘generous’ in their offers, as the headline graphic to this post suggests. In actual fact, the offers they are making are peanuts compared to the additional profits they make through gamblers making accumulator bets.

However… all of this assumes that the bookmaker sets prices accurately. What happens if the gambler is more accurate in identifying the fair price for a bet than the bookmaker? Suppose, for example, a gambler reckons correctly that the probabilities for players A and C to win are 0.55 rather than 0.5. A single stake bet spread across the 2 matches would then generate an expected profit of

$0.55\times(1/2 \times 1.9) + 0.55\times (1/2 \times 1.9) -1 = 0.045$

On the other hand, the expected profit from an accumulator bet on A-C is

$(0.55\times1.9) \times (0.55\times1.9) -1 = 0.092$

In other words, just as the bookmaker increases his expected profit through accumulator bets when he has an advantage per single bet, so does the gambler. So, bookmakers do indeed love accumulators, but not against smart gamblers.

In the next post we’ll find out how not knowing the difference between accumulator and standard bets cost one famous gambler a small fortune.

Actually, the situation is not quite as favourable for smart gamblers as the above calculation suggests. Suppose that the true probabilities for a win for A and C are 0.7 and 0.4, which still averages at 0.55. This situation would arise, for example, if the gambler was using a model which performed better than he realised for some matches, but worse than he realised for others.

The expected winnings from single bets remain at 0.045. But now, the expected winnings from an accumulator bet are just:

$(0.7\times1.9) \times (0.4\times1.9) -1 = 0.011,$

which is considerably lower. Moreover, with different numbers, the expected winnings from the accumulator bet could be negative, even though the expected winnings from separate bets is positive. (This would happen, for example, if the win probabilities for A and C were 0.8 and 0.3 respectively.)

So unless the smart gambler is genuinely smart on every bet, an accumulator bet may no longer be in his favour.

# Stuck in jail?

In an earlier post, Get out of jail,  I set the following problem:

If I roll a standard dice until I get a 6, how many rolls of the dice will I need on average?

A summary of the 8 answers I received is given in the figure below:.

So, 3 people got the answer right, perhaps because they know the general theory which leads to this answer. All other respondents under-estimated the answer, perhaps not taking into account that the number of throws needed could be 10, 20 or, in theory, even more.

But maybe I wasn’t fair in the question, since ‘average’ can have different meanings. The usual interpretation is the ‘mean’, and it’s the mean which takes the value 6. But another choice is the median, which for this problem is 4: on roughly 50% of occasions you’d need 4 throws or less to get a 6, and on a similar amount of occasions you’d need 5 throws or more. So, if you interpreted my question as asking for the median, you were right if your answer was 4, and close if your answer was 3. So again, everyone did really well by one interpretation of the problem. (Of course, if your answer was 3 because you divided 6 by 2 you were close, but for the wrong reason).

The reason why the mean and the median are so different in this problem can be seen in the following figure, which shows the probability for every possible number of throws from 1 to 25. Beyond 25, the probabilities are all very close to zero.

If you imagine the lines showing the probabilities as being made of strips of metal lying flat on a piece of paper, then the mean is the line of equilibrium – i.e. if I place my finger vertically at the mean – so, 6 in this case – the figure would balance perfectly. (Or at least it would if I hadn’t truncated the graph at 25 – in reality the vertical lines stretch out to infinity, but with smaller and smaller heights).

In contrast, the median is the vertical line at which the total lengths of the bars are equally balanced on each side. We can’t get this perfectly, because of the jumps in the lengths from one bar to the next, but very roughly the sum of the lengths of the bars up to the fourth one is equal to the sum of the lengths from the fifth one onwards, so the median is 4.

Consequently, the mean and median are points of equilibrium by different physical rules – by weight for the mean and by total length for the median –  and when probability distributions are very asymmetric, as in the figure above, the values can be quite different.

Anyway, I’d intended to ask for the mean number of throws required, and the answer to that is 6. But why?

It’s not a proper proof, but suppose I rolled the dice 6 million times. Because of the symmetry of the dice, you’d expect around 1 million of those throws to come up 6. And those 1 million 6’s will be randomly spread among the 6 million throws. So, on average, the 6’s will be 6 throws apart. In other words: you have to wait an average of 6 throws after rolling a 6 to throw another 6. And by similar reasoning, you’d have to wait an average of 6 throws before getting the first 6.

Obviously, there’s nothing special about the number 6 here. Or about dice. In general, if I repeat an experiment where there are $N$ different possible outcomes, each of which is equally likely, the average number of times I’ll have to repeat the experiment before having a success is $N$. For example, if cereal packs contain a gift, and there are 10 different available gifts, I’ll need an average of 10 cereal packs to get any particular gift that I’m hoping for.

Just for completeness, and it’s entirely optional, here’s a formal mathematical proof.

Let the average number of throws required be $A$.

On the first throw of the dice there are 2 possibilities:

• I get a 6.
• I don’t get a 6.

These possibilities occur with probability 1/6 and 5/6 respectively. In the first case, I’ve achieved the objective of rolling a 6, and so the total number of throws needed was 1. In the second case, I haven’t achieved the objective, and so still have to make $A$ throws on average to get a 6, on top of the throw that I’ve already made. In other words, in this case I will have to make a total of $A+1$ throws on average. So, with probability 1/6 I just need 1 throw, but with probability 5/6 I need an average of $A+1$ throws. But we also know that the average number of throws overall is $A$. So

$A =1/6 \times 1 +(5/6)\times (A+1)$

This gives an equation to solve for $A$, and you can easily check that it works with $A=6$.

One more quick aside based on the responses to the original post: it’s obviously difficult to draw many conclusions from just 8 responses, though I’m grateful to those of you who did respond. Clearly this type of post isn’t generating much interest, and maybe that’s true of the blog as a whole. I’m planning to give the blog a bit of a break over Christmas anyway, but before then I’ll include a post inviting feedback so that I can try to push the blog in a different direction if that’s preferred. Or maybe just wind things up if that seems more appropriate.

# Borel

Struggling for ideas for Christmas presents? Stuck with an Amazon voucher from your employer and don’t know what to do with it? No idea how you’re going to get through Christmas with the in-laws? Trying to ‘Gamble Responsibly‘ but can’t quite kick the habit?

You can thank me later, but I have the perfect solution for you:

Borel

This is a new Trivial-Pursuit-style board game, but with a twist. Players are given a question involving dice, coloured balls or some other experimental apparatus, and have to bet on the outcome. There’s not enough time to actually do the probability calculations, so you just have to go with intuition. You can make bets of different sizes and, just like in real life, should make bigger bets when you think the odds are more in your favour.

This is part of the description at Amazon:

The game combines the human mind’s difficulty to deal with probabilistic dilemmas with the strategic thinking of competitive gambling.

And:

It is designed to reward probabilistic reasoning, intuition, strategic thinking and risk-taking!

In other words, it’s just like Smartodds-world, but without models to help you.

Disclaimer: The description and reviews look great, and I’ve ordered a set for myself, but I haven’t played it yet. I’ll try it on my family over Christmas and let you know how we get on. If you want a set for yourself or your loved ones, it’s available on Amazon here.

# Get out of jail

As a rule, I don’t intend to use this blog to cover standard theory in probability or Statistics. But for a number of reasons, which will become clear in future posts, I’d like you to think about the following problem.

In the game of Monopoly, when you’re in jail, one way of getting out is to throw equal numbers – a so-called double – on the two dice. Actually, in standard Monopoly rules, you’re only allowed to try this method 3 times, and are then required to pay your way out, unless you have a ‘Get out of Jail Free’ card. But suppose there weren’t any such limit to the number of throws you could take, and just kept taking further turns until you rolled a double. In that case, how many rolls, on average, would it take for you to roll a double and get out of jail?

It’s very easy to show that the probability of throwing a double on any one throw is 1/6: let the score on the first dice be S; then the two dice will have the same score if the second dice also shows S. And the probability of that, by symmetry of the dice, is 1/6.

So actually, since 1/6 is also the probability of throwing a 6 on a single dice, this problem has an identical solution to the following one:

If I roll a standard dice until I get a 6, how many rolls of the dice will I need on average?

This is a standard problem in probability and statistics, so anyone who’s studied statistics to a reasonable level will automatically know the answer. But if you don’t know the answer, use your intuition to guess what it might be. Either way, please send me your answer via this survey.

I’ll discuss the solution – and your guesses – in a future post. Like I say, I’ll also be making use of the result in a couple of different ways, also in future posts.

# Rather less than 7.8 billion

In a previous post I set a variation of the classic birthday problem:

What’s the least number of people you need in a room for there to be a 50% chance or more that everyone in the room has the same birthday as someone else in the room?

I mentioned that the problem is difficult to solve, but thought it might be interesting to see how good we are collectively at guessing the answer.

The actual value turns out to be 3064.

It’s not for the faint-hearted, but there’s an academic paper which contains a formula to calculate this result, although the formula as written seems to contain a misprint. Moreover, trying to implement the formula in a simplistic way leads to numerical instabilities resulting in both negative probabilities and probabilities greater than several million (!) for some choices of the number of people in the room. However, the corrected version of the formula seems to work over a reasonable range of numbers. (I checked with a simple simulation routine.)

Anyway, using the corrected formula results in the above graph, which shows the probability that everyone shares a birthday for numbers of people between 2000 and 5000. Below 2000 the probability is essentially zero; above 5000 and it’s essentially one. But between 2000 and 5000 the probability behaves as shown in the graph. You can see that to get a probability of at least 0.5 you need just over 3000 people, and actually the smallest number which takes the probability over the 0.5 threshold is 3064. If you guessed anywhere near that value, or indeed anywhere between 2000 and 5000, you did amazingly well.

One interesting thing about this problem is that the graph suggests that the fewer the people there are in the room, the smaller the probability that they all share the same birthday. Certainly for numbers within the range 2000 – 5000 we can see from the graph that’s true. It’s also true well outside of the range 2000 – 5000.

However, there’s one simple case where the probability is easy to calculate. Suppose there are just two people in the room. In this case the probability that everyone in the room shares a birthday is 1/365. To see this, suppose the first person’s birthday is D. Then everyone – i.e. both people – in the room will share a birthday if the second person’s birthday is also D. Under usual assumptions this is simply 1/365. So, although the graph above decreases as the number of people decreases (i.e. moving along the graph from right to left), there must be a point at which it starts to increase again, in order that when there are 2 people the probability goes up as far as 1/365.

As I wrote in the original post, one reason for setting this problem is to see how well we are able collectively to make a judgement on a problem like this, for which the true answer is very difficult to obtain. Your collective results are summarised  in the following figure, with guesses shown as dots and the true answer shown as a red line:

The guesses varied from 184 to 50,000, with most of the guesses towards the lower end of that range. So, to show the values in a reasonable way, I’ve had to use a logarithmic scale for the graph. Each dot on the graph represents somebody’s guess, and I’ve had to jiggle the points a bit where there were two identical or near-identical guesses.

I’d summarise things as follows:

1. If you count the dots you’ll reach a total of 12. So thanks to all 12 of you who replied, and I’m happy to buy each of you a drink at the Christmas dinner.
2. Before you get too impressed by the fact that two people seem to have guessed the right answer, neither of these ‘guesses’ was perfect. One was 3061, the other was 3065. The fact that they are wrong implies that these respondents didn’t develop, or even google, the exact formula. And don’t be too impressed that they were so close to the true answer either: the guesses are so good that they are almost certainly not just guesses. Chances are that both these attempts derive from a simple simulation of the exercise, similar to the one I used myself to check the formula. It’s easy to get very close to the answer this way, but the inherent randomness of simulations means you need a very large number of simulations to get an accurate estimate of the probability. And deciding, for example, whether 3064 people leads to a probability slightly below or slightly above 0.5 is likely to be very time-consuming. (Time consuming for the computer, that is. I’m not very good at programming, but my version took about 5 minutes to code.)
3. Excluding the two cheats two clever people who almost certainly used simulation to solve the problem, most respondents underestimated the number of people needed. Remember, that until you get to around 2000 people, the probability is essentially zero. Only two of the remaining respondents overestimated the number. And the respondent who guessed 5000 was the person with a genuine guess who came closest to the true answer. Indeed, their guess of 5000 just about made it onto the previous graph showing all the probabilities that were greater than 0, but smaller than 1.

Conclusion: this was a very difficult problem to have much intuition about, even though the specification of the problem is very simple. Collectively we tended to underestimate the number of people needed, perhaps having been influenced by the fact that the number of people required to solve the classical birthday problem, 23, is surprisingly low. I actually think the distribution of values around the true number – albeit on a logarithmic scale – shows a reasonably good collective attempt at guessing the true answer. One way of seeing that is to use standard statistical techniques to create a probability distribution based on your guesses. This is shown in the following figure (again on a logarithmic scale):

As you can see, the true value sits reasonably well in the heart of the estimated distribution, albeit towards the upper end. Again this confirms that the collective answers were pretty good, showing the value of teamwork over individuality, even when it comes to guesswork. Remember to collect your free Christmas drink from me as a reward. (APPLIES TO RESPONDENTS ONLY)

# Did you swap?

Thanks to all of you who responded to the recent post double your bonus where I posed the following question:

You are presented with two envelopes. One contains exactly double the amount of money contained in the other. You open one of the envelopes and observe that it contains ￡1000. You can keep this as your bonus, or swap it for the other (unopened) envelope, whose contents will then be your final bonus, without the option of swapping back. What will you do?

We’ll look at your answers below, but first let’s discuss the problem itself.

Let’s first assume that you haven’t a clue what level of bonus you are expecting, so you have no idea whether ￡1000 is on the high or the low side.

Here’s one argument: I opened one envelope and found ￡1000, so I know the other envelope must contain ￡500 or ￡2000. The average of these alternatives is ￡1250, which is greater than the ￡1000 I could safely keep. So, my expected winnings are greater if I swap, and it’s in my interests to do so. In other words: sometimes I’ll do better by swapping, and sometimes I’ll do worse, but on average I’ll be ￡250 better off, so I should swap.

But there’s an alternative, equally compelling argument.  Both envelopes were identical. I chose one at random. By symmetry there has to be a 50/50 chance that this is the best choice. Knowing the envelope contains ￡1000 doesn’t change this fact because I had no idea what my bonus might have been. So, there can’t possibly be any advantage or disadvantage in swapping, and I can either swap or not without any gain or cost (on average).

It’s difficult to see a flaw in either of these arguments, but they can’t both be right. Actually,  the first argument is wrong, though it’s not easy to see why. A fairly detailed explanation of the flaw in the logic is given in Wikipedia,  though in the version of the problem stated there, the first envelope is unopened, and you have to choose whether to swap it without knowing its contents. However, if you have no idea whether ￡1000 is a good or a bad bonus, then opening the envelope and seeing ￡1000 gives you no extra information, and you might as well have not opened it, in which case the Wikipedia discussion is equally relevant.

The correct version of this argument is to fix the amount of money in the two envelopes as M and 2M say. If you happen to pick the envelope that contains M you will gain M by swapping. If you pick the envelope that contains 2M you will lose M by swapping. So on average, since both cases were equally likely, you gain 0 by swapping.

That’s the textbook answer: there’s no gain to be had in swapping and you can therefore be indifferent about whether to swap or not.

However… things change if you have some idea of what your bonus is likely to be. If you were expecting a fairly small bonus and ￡1000 exceeds your expectations, then this provides additional information that your envelope is likely to be the one containing 2M rather than M. In that case you’d be advised to stick with the ￡1000. But if you were expecting a high bonus, the opposite is true: your prior beliefs imply that your envelope is more likely to be the one containing M than 2M and you’d be advised to swap.

So, congratulations: whatever answer you sent me, you were right!

*Though not necessarily for the right reasons*

Thank you again to those of you that responded to the original post: your answers are summarised in the following set of bar plots.

The plot in the top left corner shows most of you who replied thought it best to swap: presumably because you’d made the calculation that ￡1000 was lower than the bonus you were expecting. 😁

The other three plots break the results down according to how you answered the second question about level of statistical training. What I thought might happen here is that people with the least statistical training might favour being indifferent about swapping – which, in the case where you have no idea what your bonus should be – is the most sensible answer. Whereas I thought  individuals with more statistical training might be more likely to fall into the trap of the argument which suggests you should swap. The plots above don’t really support that hypothesis, but with a total of 25 replies spread over 3 categories, it would be remarkable if that pattern showed up anyway.

I’d also intended to break the answers down by the third question relating to position in the company, but I only got one reply from employees at management level  and two from clients or other non-employees. I’d hoped there might be enough data to show that managers, who were expecting a high bonus, would be more likely to swap, whereas non-management employees, for whom ￡1000 might seem a reasonably significant sum, were more likely to stick. But it’s impossible to tell if that was the case from the few data I received.

So, in summary, there’s not really enough information to conclude anything other than the fact that there was a strong preference overall to accept the swap.

Finally, some of you were also kind enough to write to me to explain your decisions. I really appreciate that effort. Of these responses my favourite was from Paul.Hakim@smartodds.co.uk who wrote:

I’m going with a) the definite swap…..gambling all day long 😃

# Between 23 and 7.8 billion

Some of you might remember that a while back I gave a talk at an offsite where I used the classic birthday problem as a motivating example when discussing the potential pitfalls when of looking back at data and identifying coincidences that seem too unlikely to have occurred by chance.

The problem is this: what’s the least number of  people you need in a room for there to be a  50% chance or more that at least 2 people have the same birthday? And the answer, which seems surprisingly low to most people, is 23.

Anyway, Sunday is November 11th, so happy birthday to Harry.Hill@smartodds.co.uk, Rickie.Reynolds@smartodds.co.uk , willfletcher1111@gmail.com. And me.

In honour of this occasion I’d like to give you a variant of the classic birthday problem:

What’s the least number of people you need in a room for there to be a 50% chance or more that everyone in the room has the same birthday as someone else in the room?

They don’t all have to have the same single birthday, but there must be no one in the room who has a unique birthday.

So, just to be clear: with 23 people we know there’s a 50% chance that at least 2 people will share a birthday. But it’s very unlikely in that case that everyone in the room shares a birthday with someone else in the room. On the other hand, if we squeezed the whole population of the world – 7.8 billion people – into a single room, it’s pretty much guaranteed that everyone will share a birthday with someone else in the room. So to get a 50% chance that everyone in the room shares a birthday, we’ll have to fill it with somewhere between 23 and 7.8 billion people. But how many?

The exact calculation isn’t very easy, so I’m not expecting you to actually do it. But I am interested in what you might guess this number to be. So, can I ask you please to have a guess and send me your answer via this survey? The answers will be anonymous, but I think it might be interesting to see how accurate, collectively, we are at guessing the answer a problem of this type. So, please don’t be shy, just click to the survey, enter your best guess, and hit return. In a future post I’ll give the actual answer and summarise the answers that you send me.