Pages

Thursday, 18 July 2013

14.2 Some notes about Just-Dice.com gambling probabilities part 1

17th July 2013

0. Introduction
I have recently spent some time on just-dice.com. It's mesmerising, watching people place bets worth tens of thousands of US dollars, and several times I watched various gamblers gain (and sometimes lose again) over a hundred thousand dollars in the course of a few hours. I also saw a gambler bet one ten thousandth of a US cent almost one million times over the course of a couple of days. 

Just-Dice has a chat room, and many people there are keen to work out what other (successful) gamblers' betting methods were, how likely 10 losses in a row are, and so on. I thought this might be a good time to collect in a few posts parts of what I've learned in discussions with bitcointalk forum member dooglus over the past year or so of sticking my oar in at the SatoshiDice Statistical Analysis thread at the bitcointalk.org forum. 

Most of what follows applies to any gambling game that has a binary win / loss outcome for a given and known probability. I'm using Just-Dice as an example for several reasons:
  • The house advantage is only 1%
  • Bets as low as 1 satoshi are allowed, which means gamblers can play with martingale methods and risk less than otherwise.
  • Game choice is simple - a bettor specifies the probability of winning or the expected return on a win, and then places a bet. Automatic methods are also available.
  • Investors provide the majority of the site's bankroll. 
  • dooglus is the owner-operator of the site, and has guaranteed that each roll is provably fair.
These options mean that the site attracts many people who might otherwise be risk averse, or just want to experiment. I hope to provide some food for thought for gamblers and investors alike.

I'm making this a series of posts covering topics in small bite site chunks - I hope that you're able to experiment with them (or just watch others with a deeper understanding of what's happening) and understand them before I move to the next topic. Questions are welcome.

Disclaimer: I have a small amount of bitcoin invested on the site, mainly to see what would happen to it. So far, it is smaller than it was - I was also unprepared for variance, although I shouldn't have been.

1. Probability of exactly k losses before a win
While I'm sure most seasoned gamblers are aware of the expected (or average) number of losses in a row for a given probability game, I noticed that many in the chatroom weren't, so this is a good place to start.

For a game with a probability to win of p, the probability of winning a bet on the first attempt is p. This is a trivial result, so on to the probability of winning after one loss is the probability of one loss and then one win:


After two losses, the probability of two losses and one win:


And after three losses, the probability of three losses and one win:


In general, the probability of a win after exactly k losses is the probability of k losses followed by one win:


The probability distribution of the number of losses before a win occurs is known as the Geometric distribution, and if you want a bit more background read the Wikipedia page before continuing.

2. Probability of at most k losses before a win
The probability of at most k losses before a win is the sum of the preceding probabilities of wins after exactly k = 1 ... k  losses. For example, the probability of a win after at most 3 losses is:


More generally:


The formula for a geometric series is:


This can be applied to (1) by defining q = (1-p) and continuing as follows:



This is the cumulative distribution function (CDF) for the geometric distribution.

As an example, the probability of at most ten losses before a win when the probability of a win is 0.2 is 1 - (1 - 0.2) ^ 11 = 0.9141007 - meaning that 91.4% of the time a win will occur before there have been ten losses.

3. Probability of at least k losses before a win
This is simply the lower tail of the CDF and is:


Using the example above, the probability of at least ten losses before a win when the probability of a win is 0.2 is (1 - 0.2) ^ 11 = 0.08589935, which is 1 -  0.9141007, the  probability of at most ten losses before a win.


4. The expected number of losses before a win
The term "expected value" should be well known to gamblers; it is the "average value" of a random variable. It is calculated by multiplying the probability of a random variable by its numerical value and summing the values between the minimum and maximum values the random variable can have - in this case between 0 (no losses before a win) and infinity.


"E(X)" means the "expectation of X" (the expected value of  a random variable) and the symbol starting the right hand side of the equation means "sum from k = 0 to k = infinity".  If you drag out some rusty geometric series knowledge, you should be able to follow the derivation:

i) define q = 1 - p and substitute:


ii) from the Derivative of a geometric progression:


Since the first value summand in the series is 0 * (1 - q),  (2)  becomes:




The result (3) means that the average number of losses before a win occurs will be 1/p - 1. For example, if your bet probability is 0.2, the average number of losses you'll see before a win is 1/(1/5) - 1 = 4.


5. Summary

a) The probability of exactly k losses before a win:


b) The probability of at most k losses before a win:


c) The probability of at least k losses before a win:


d) The expected (or average) number of losses before a win:




This will be fairly basic stuff for many inveterate gamblers, but I hope a few of you who weren't previously acquainted with these results and formula will be able to use them to gamble with a better knowledge of what the outcome might be.

In the next few posts I'll try to illustrate the expected maximum run of losses for a given game, and explain why the martingale betting system is much more risky than most people think. Also I'd like to come up with an explanation for investor variance, but I'm not sure if I have the time or chops for that.


organofcorti.blogspot.com is a reader supported blog

BTC:  12QxPHEuxDrs7mCyGSx1iVSozTwtquDB3r

For notification of new posts, follow @oocBlog

Math published using QuickLaTeX.com


<fourteenpoint two>

No comments:

Post a Comment

Comments are switched off until the current spam storm ends.