Showing posts with label staking systems. Show all posts
Showing posts with label staking systems. Show all posts

Tuesday, February 6, 2007

Kelly for the cowardly

Kelly staking is - as we've seen before - the mathematically optimal way to grow your bankroll. It has one glaring problem, though: it's horrifically volatile. Let's imagine we make 100 bets which we know are 50-50 shots but the bookies insist on pricing at 2.10. Our Kelly stake is (po-1)/(o-1) = 4.55%.

Now, when we win, we tend to win big - about a quarter of the time, we'd get 53 or more correct. That would net us at least a 49% profit. The flip-side of that is, a quarter of the time we get 46 or fewer and lose a quarter of our bankroll. There's a one in twenty chance that we'll lose half of our bankroll (although one in ten that we'll double it). With bigger edges or shorter odds, the fluctuations can be terrifying.

Is there a way to reduce them? Well, obviously, if you don't bet so much, your bankroll is steadier. But let's say you're still pretty greedy, and want to maximise your worst plausible outcome.

How do you even define that? Well, given that we're looking at a binomial distribution, we can use stats to help us. If we look at N identical bets with probability p, we know that 97.7% of the time* we'll win at least Wmin = Np - 2 sqrt(Np(1-p)) of them. Bumping up the 2 to 3 gives us 99.87% confidence.

Whatever value we choose - I'm happy enough with two - outlines our worst plausible set of results over N trials**. We can then calculate our worst plausible outcome, which is B0 (1 + k(o-1))Wmin(1 - k)(N-Wmin).

The trick now is to maximise this with respect to each k. It turns out, if we define p* as Wmin/N, that our optimal Kelly stake in this sense is (p*o-1)/(o-1). And if it's less than zero, we don't bet.

This is quite restrictive - in the case above, with N = 100 we simply wouldn't bet - p* is 40%, far too low to allow us to meet our minimum. N = 1000 isn't that much better - p* = 46.8%, where we need 47.6%. N = 2500 is just about enough.

Here are the results of running 2500 bets 1000 times over (using the two staking patterns on the same events):

Pure Kelly Modified
Stake 4.55% 0.73%
AROI*** 26.07% 3.81%
SD 64.52% 23.58%
Worst -79.85% -11.44%


So, on average, Kelly outperforms the modified version by some way - but at the cost of much higher risk. The modified stakes 'guarantee' that the lowest plausible value is as large as possible.

It is possible to make up the discrepancy to a fair degree by increasing N, because the larger N is, the closer p* is to p (the square root term ends up getting very small).

Modified Kelly staking is worthwhile for bets with sufficiently large edges, or over sufficiently long runs. If you plan to make only 100 bets, you would need odds of at least 2.5 on a 50-50 shot before the modified stakes allowed you to bet.

I just typed bed, which is probably a Freudian slip. It's getting late.

* Look it up in a normal distribution table.

** We needn't assume the bets are identical. In general, we can replace Np with sum(p) and the bit inside the square root would be sum( p(1-p) ). But that complicates things a bit more than we need for the proof of concept.

*** Average Return on Investment

Sunday, January 28, 2007

Kelly staking

Mathematician John Kelly came up with a system for staking which maximises your expected return over the long term. This is going to be a load of maths, so look away now if you're not interested.

Assuming you bet a proportion k of your bankroll each time at odds o, after you win W and lose L bets, you have B' = B [(1 + k(o-1))W (1 - k)L]. We want to find the maximum of this, so we take the derivative and set it to 0:
dB'/dk = W(o-1)(1-k) - L(1 + k(o-1)) = 0.

Or, W(o-1)(1-k) = L(1 + k(o-1)). Since over the long term, W/L -> p/(1-p) (see earlier post on the Law of Large Numbers), we can substitute in to get:
p(o-1)(1-k) = (1-p)(1 + k(o-1)). A little algebra then gives us:
k = p - (p-1)/(o-1), the Kelly Staking formula.

That means, if you assess the probability of the outcome to be 50% and the odds are 2.10, you should stake 0.5 - 0.5 / (1.1) ~ 0.5 - 0.45 = 0.05: a twentieth of your balance.

That's a big gamble. After losing a few consecutive bets, your bankroll of GBP1000 would have dwindled like this:
1. Bankroll: 1000.00 Bet: 50.00
2. Bankroll: 950.00 Bet: 47.50
3. Bankroll: 902.50 Bet: 45.13
4. Bankroll: 857.37 Bet: 40.72
5. Bankroll: 816.65

In four bets, you've lost nearly a fifth of your bankroll! On the other hand, if you'd won, you'd be laughing:
1. Bankroll: 1000.00 Bet 50.00
2. Bankroll: 1055.00 Bet 52.75
3. Bankroll: 1103.03 Bet 55.65
4. Bankroll: 1174.24 Bet 58.71
5. Bankroll: 1238.82

And you're up almost 24%. Kelly staking is a wild ride. As long as your value calculations are right, you'll end up way ahead in the long run*. Occasionally you'll lag at the wrong end of the binomial distribution and look like you're way behind.

Some gamblers choose to use a slightly less volatile system called fractional Kelly, in which they split their bankroll into (say) five separate bankrolls and use only one for Kelly calculations. That dampens the volatility a bit, but does make for smaller gains when you're winning.

So long as your value estimation is correct and the law of large numbers takes hold quickly enough - and you can stand the wild fluctuations in your bankroll - Kelly staking is the most profitable system known to mathematics. Use it wisely.

* In the above situation, you'd need about 1800 bets to be 95% sure of breaking even or better.

Wednesday, January 24, 2007

The Martingale

You're in the casino and place a $1 bet on red. It doesn't come up, so you place a $2 bet on red, so that if you win you pick up $4 - everything you've staked so far, plus a dollar. It misses again, so you bet $4 - the $8 you'll surely win THIS time covers all you've staked - $1 + $2 + $4 = $7, plus a dollar to win. Red's bound to come up eventually, so eventually you'll make your dollar. It's a foolproof system! It's called the Martingale, and - unfortunately - it doesn't work very well.

The word martingale derives from the town on Martigue in Provence, southern France. In Martigue, where trousers were traditionally worn fastened at the back. "A la martingale" soon came to mean 'in a ridiculous fashion' and is applied in exactly that sense to the system above.

The problem with the Martingale is that your bet size gets very big very quickly - as you can see below.

Bet number: Stake size
1: $1
2: $2
3: $4
4: $8
5: $16
6: $32
7: $64
8: $128
9: $256
10: $512

After losing ten bets in a row (which will happen a little fewer than once in a thousand times*), you'll be looking to gamble over $1000 dollars to win just one in return - and the odds you're getting are still a little worse than evens. Yes, you're bound to win your dollar in the end - as long as you have an infinite bankroll. Eventually, you will simply reach a point where you don't have enough to carry on playing, and you have to stomach a devastating loss.

* Actually, in a casino the odds are slightly worse than this because of the house edge. In an American casino with two zeroes, the probability of red is about 0.47 rather than the 50% implied by the odds. That makes the probability of ten losing red bets in a row about one in 610.