The perception of probability is something we human beings are not as good at as we could assume.

“In describing how we think and decide, modern psychologists often deploy a dual-system model that partitions our mental universe into two domains. System 2 is the familiar realm of conscious thought. It consists of everything we choose to focus on. By contrast, System 1 is largely a stranger to us. It is the realm of automatic perceptual and cognitive operations—like those you are running right now to transform the print on this page into a meaningful sentence or to hold the book while reaching for a glass and taking a sip. We have no awareness of these rapid-fire processes but we could not function without them. We would shut down.”

– Philip Tetlock “Superforecasting: The Art and Science of Prediction”

Many of us use System 1 to make quick decisions. For example, imagine a lottery draw in which there are one hundred people and each one has a ticket. Now imagine another draw in which there are only two participants, one with only one ticket and another one with the remaining 99. The person who in both cases has only one ticket usually prefers the first draw to the second, but the probability of winning is exactly the same!

In the Christmas Lottery draws, all numbers are loaded into a drum and each of them should have the same probability. That is, the series of winning numbers in all draws should be a series of random numbers.

This was taken so seriously that in the past, before the appearance of computers, the series of winning numbers in the Christmas Lottery draw was used as a source of random numbers to generate values of other variables. Now it is no longer done that way, but with recurring algorithms that generate pseudo-random numbers. “Pseudo” because they are generated “synthetically” in the computer but “random” because, if the generator is effective, the resulting numbers support the corresponding statistical tests and are perfectly valid.

But is the series of winning numbers in the Christmas Lottery a good series of random numbers? That is, can we admit that the probability of extraction for all numbers in the drum is the same, as the theory says?

Let’s see what has happened historically with the lottery in Spain.

## Goodness of fit tests

There are ways to check if a series fits a certain statistical distribution or not. Statistical tests of “goodness of fit” allow us to infer whether the data in a sample follow a certain distribution or if there is sufficient evidence to say no. One of the most used is the Chi-square, which basically compares the number of observations obtained with the number of theoretical observations. We ask Eduardo Caro, Professor of Statistics at the Polytechnic University of Madrid, to illustrate its fundamentals:

“Let’s imagine that I have an opaque bag with a lot of balls. I can tell you that half the balls are white and half are black. You, however, suspect that it is not so.

In order to prove to you that there is the same amount of white and black balls, I let you extract five balls. You extract five balls, … and they are all black!

Could you conclude that there are not as many white balls as black ones?

If that were your conclusion, there is a possibility that you are wrong in your verdict, since it could be that the bag actually contains as many white balls as black, and (by pure chance) you have only obtained black balls.

The probability of being wrong is (1/2)^5 = 3%. That is, the probability of obtaining five black balls in a bag that had the same amount of black and white balls is 3%.

Therefore, given the result of that experiment, the statement “there are not as many white balls as blacks” can be made with 97% confidence.

However, if we continue the experiment and get ten black balls in a row, you will surely conclude “the bag does not have as many white balls as black”, since then the probability of making a mistake in that statement is less than 0.1%.

Therefore, whenever we do a statistic test, the conclusions obtained are subject to a level of confidence or a “level of error.”

The concept of level of confidence is not intuitive. A high level of confidence indicates that the demand on the data is more strict in order to reject the hypothesis. In the previous example, if we demand 99% confidence, taking 5 consecutive black balls would not be enough to conclude that there are not as many white as black balls. Whereas if we demand 95% then we would consider it unlikely.

## The lottery

To approach the case of the lottery, suppose there are 10,000 winning numbers and we group them by their last three figures. Thus, we will have winners finishing in 000, 001 … and so on until 999. As there are 1000 different endings, we expect that there will be 10 numbers finishing in 000, 10 in 001 and so on.

Our test will compare whether or not the numbers that have been found resemble those 10 theoretical values or not. In the following figure, for each ending we have the theoretical value in gray and the real one in orange. The test calculates to what extent the two graphs look similar. If they look alike, we cannot reject the hypothesis that the numbers are random and if they don’t look alike we can reject it.

In the case of the Christmas Lottery we could check if the series numbers follow an equiprobable random distribution, but unfortunately we have not found a complete list of these numbers.

Alternatively, www.loteria.es offers the data of the last 1273 draws of the National Lottery of the last twelve years. Although the extraction method is not from a unique drum, the numbers should behave randomly anyway.

From the analysis of the last two digits of the 1273 draws, after performing the Chi-square test, the result obtained with a 99% confidence level, indicates that we have no mathematical evidence that the data does not follow an equiprobable random distribution; however, if we only require 95% confidence, the sequence is not random.

That is to say: of all the possible sequences of 1273 values, only 5% would look less like a random sequence. This margin is at the limit of what is traditionally accepted.

*Image by Carabo Spain from Pixabay*