How Unlucky Am I?

Ever had the grueling experience of advantage gambling for an extended period of time only to have nothing to show for it? How unlucky were you really? In this article I will show two simple methods for determining this. It will also help to mentally prepare you given that you will know the expected variance beforehand!

Method 1: Binomial Distribution Formula

Taken from Wikipedia, we can calculate the probability of exactly k bets winning in n trials by the following formula:

Where:

P(e) is the probability of the specific event occuring e.g. exactly 5 wins in 10 spins

n is the number of trials e.g. n=10 if we did 10 spins

k is the number of times our bet wins

P(b) is the probability of a bet winning in one trial e.g. 0.486 for a bet on red in roulette

For those that don’t know, the ‘!’ symbol is called a factorial. For most intents and purposes it means to multiply the number by all of the numbers before it down to one e.g. 5! = 5*4*3*2*1 = 120. As you can see, the numbers get large rather quickly. Thankfully there’s a mathematical trick we can use to get around this to avoid needing a supercomputer.

Example

In my Lucky Numbers Bingo article I mentioned that in 3101 games I only won three silver jackpots despite the probability of the silver jackpot being 1/450. In theory I should have won nearly seven. How unlucky was I?

To solve this we can use the binomial distribution formula to calculate the chance of getting exactly 0, 1, 2 and 3 wins within 3101 trials.

Let’s start with the easiest calculation of zero wins.

Curiously 0! = 1 and not 0. I would explain why but it will make the article more confusing than it needs to be and there are splenty of resources on the internet that you can search yourself to learn more on the topic.

The equation can then be simplified down to (1-1/450)^3101 given that the other two terms are equal to one. This gives P(0, 3101) 0.001.

Now let’s do the same for 1 win in 3101 games:

If you try and plug this into a calculator you’ll probably get an error since it won’t be able to calculate 3101!. Luckily we can use the trick I alluded to earlier:

3101! = 3101*3100*3099*3098….*3*2*1

3100! = 3100*3099*3098*3097…*3*2*1

Because we’re dividing the factorials we don’t need to calculate what the value of each number actually is. Notice how 3101! is the same as 3100! except we’re multiplying by an extra 3101. This means that when we divide 3101! by 3100! every single term will cancel apart from 3101. This gives a very neat and tidy answer to the expression.

Hence the probability of 1 win in 3101 games is 3101*(1/450)*(1-1/450)^3100 0.00697

From then on it should be simple to calculate 2 and 3 wins:

Hence the total probability of all events is 0.001 + 0.00697 + 0.02406 + 0.0553 = 0.08733. So to answer the original question, there was about a 9% chance that I have been this unlucky.

Method 2: Monte Carlo Simulation

The second and perhaps the easiest way is to write a simple script that will perform a Monte Carlo Simulation like the widget I have on my site. The easiest way in my opinion to do this for betting is as follows:

Step 1

Use a pseudorandom function as a proxy for probability of an event happening e.g. the number 2 coming up upon the roll of a die. Based on the output of the function we can say whether our hypothetical bet won by splitting the outcome of the function as a range to match the probability of the of each number of the die coming up. For example if the possible outcome for the function is between 0 and 1 and we know that every number (for both the die and the function) is equally likely then:

0 – 0.16666 corresponds to 1

0.16667 – 0.3333 corresponds to 2

0.3334 – 0.5 corrsponds to 3

etc

If our hypothetical bet wins or loses we can then calculate what our running profit and loss (P/L) will be after that bet, or whatever we’re trying to measure.

Step 2

We loop the process for many bets to form a trial and then store the pertinent data (max P/L, final P/L) as a separate array for later analysis. This basically represents a scenario of what would happen if one person did whatever strategy you’re simulating.

Step 3

We loop the entire process again so that we have multiple trials. We can then compare the results of the trials to gather statistics such as the chance of going bust or the probability of falling below a certain profit margin.

And that’s it. Let’s look at the example that we calculated using the binomial formula and see how they compare.

Example

Here’s the script that I wrote using Matlab. It can be run using Octave Online so there is no need to download any editor if you do not wish to. The script does take a while to run however and using the online version is a pain as unless you click the ‘add 15 seconds’ button it will stop the script for taking too long.

clear()
clc()
for j = 1:1000 %number of trials
for i = 2:3101 %number of bets
x(1) = 0;
a(i) = rand(); %generate a random number between 0 and 1

if a(i) < 1/450

x(i) = x(i-1) + 1; %Win

elseif a(i) > 1/450

x(i) = x(i-1); %no win

endif

endfor
N_wins(j) = x(3101); %Number of silver jackpot wins in 3101 bets
j  %prints out what trial the script is on so you know how much longer you will have to wait
endfor
Probability = sum(N_wins < 4)/1000

Here I used 1000 trials however you may find that you’ll need even more to get more accurate results. When I ran the script the number of times the silver jackpot was won 3 or less times was 86 out of 1000 trials implying a probability of 8.6%. This is very close to the exact answer we calculated using the binomial formula of 8.733%.

As a final note before finishing this article you may wish to run a monte carlo simulation in which you have two random variables e.g. you place a series of bets and then earn a bonus. This can be done the same way as above however you will need to work out all the possible outcomes beforehand within the if statement. I show an example of this at the bottom of Cassava Bingo Part 2.

Hope this has been helpful!



Leave a Reply

Your email address will not be published. Required fields are marked *