Kelly bet questionOn a zero-sum game betting marketmaximization of earrningsCalculating a metric to compare...

Too soon for a plot twist?

How to educate team mate to take screenshots for bugs with out unwanted stuff

I've given my players a lot of magic items. Is it reasonable for me to give them harder encounters?

PTIJ: Sport in the Torah

Will the concrete slab in a partially heated shed conduct a lot of heat to the unconditioned area?

Is divide-by-zero a security vulnerability?

What does *dead* mean in *What do you mean, dead?*?

Why aren't there more Gauls like Obelix?

What is Tony Stark injecting into himself in Iron Man 3?

School performs periodic password audits. Is my password compromised?

Short story about cities being connected by a conveyor belt

What is the purpose of a disclaimer like "this is not legal advice"?

Professor forcing me to attend a conference, I can't afford even with 50% funding

How does learning spells work when leveling a multiclass character?

Help! My Character is too much for her story!

What should I do when a paper is published similar to my PhD thesis without citation?

Should I file my taxes? No income, unemployed, but paid 2k in student loan interest

Insult for someone who "doesn't know anything"

What is the oldest European royal house?

What is the orbit and expected lifetime of Crew Dragon trunk?

Cycles on the torus

Is it a Cyclops number? "Nobody" knows!

In Diabelli's "Duet in D" for piano, what are these brackets on chords that look like vertical slurs?

Can the Witch Sight warlock invocation see through the Mirror Image spell?



Kelly bet question


On a zero-sum game betting marketmaximization of earrningsCalculating a metric to compare multiple posterior probability distributionsMarket Making Card Bet GameApplying Kelly Criterion to profit/loss betCompounding cash, at a gambling game with certain payout and your certain win rate.The “Bold” strategy of a single large bet is not the best Roulette strategy to double your moneyQuestion related to Kelly fractionsHow do you solve the Absent Minded Gambler problem?Probability of large number of dependant events













1












$begingroup$


I stumbled upon Kelly bet during studies and decided to try simulating it. I chose a simple example where $b = 1$ and $p = 0.6$, which gave me the Kelly bet equal to $0.2$ of the wealth. I took $25$ dollars as a starting wealth and did $10000$ simulations of a $300$ bet game with $11$ possible bets including the Kelly bet, starting from $0$ (yeah, I did get $25$ average in the end, just wanted to make sure my program worked) with increment $0.1$ up to $1.0$ of starting wealth (i.e. full $25$ bet from the get go)



The resulting wealth turned out to be abit unintuitive to me: here is the list of wealths for each bet, i.e $25.0$ is for the bet = $0$ of starting wealth, $9789.283$ is for bet = $0.1$ of starting wealth.



[$25.0, 9789.283, 4322833.16, 68980116.885, 1665088721.462, 92284022.736, 19489.665, 0.012, 0.0, 0.0, 0.0$]



Kelly bet corresponds to $4322833.16$, whichis not the max value for the given bets. It turned out that $0.5$ is the best and $0.2$ is not even close.



Why is it like that? Could someone show an intuitive or direct mathematical reason for this or give me some hints.



Thank you very much



edit: added code in python



import random

N = 300
x = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
b = 1
p = 0.6
Iter_cnt = 10000

wealthlist = []
win_rate = 0

def gamble(bet_ratio, prob, win_multi, totalbets):
wealth = 25
wincnt = 0
for i in range(totalbets):
rnd = random.uniform(0, 1) #random real in (0, 1)
if rnd >= 1 - prob: #if win
wincnt += 1
wealth *= 1+win_multi*bet_ratio
else: #if lose
wealth *= (1-bet_ratio)

return (wealth, wincnt/totalbets) #return of a tuple with 1st argument being equal to resulting wealth and 2nd argument equal to the ratio for this simulation

avg_res_1bet = 0
avg_wr = 0

for i in x: #iterate over the list of betting ratios
for j in range(Iter_cnt): #iterate as many times as the value of Iter_cnt
avg_res_1bet += gamble(i, p, b, N)[0]/Iter_cnt #calculates the average result for each of the betting ratios
avg_wr += gamble(i, p, b, N)[1]/(Iter_cnt*len(x)) #calculates the average winrate of all simulations

wealthlist.append(round(avg_res_1bet,3)) #adds the resulting wealth to the final list, rounded to 3 decimals
avg_res_1bet = 0 #have to nullify in order to make the above command work properly


print("Sample win ratio is: {}".format(avg_wr)) #output
print("Final wealth is: {}".format(wealthlist)) #output









share|cite|improve this question











$endgroup$












  • $begingroup$
    What were the $11$ possible bets?
    $endgroup$
    – saulspatz
    Feb 15 at 20:50






  • 1




    $begingroup$
    $0.0, 0.1, 0.2 ... 0.9$ and $1.0$ of the starting wealth. I.e. $0, 2.5, 5... 22.5$ and $25$
    $endgroup$
    – Makina
    Feb 15 at 20:52












  • $begingroup$
    I think 300 bets is too small. If you up the number of bets (say, 3000), it's much more likely you'll see the correct behavior.
    $endgroup$
    – user113102
    Feb 15 at 21:38










  • $begingroup$
    Your values are far too large. I have checked saulspatz' result for 178 wins and you wind up with 4668.53 as he says. There is something wrong with your program
    $endgroup$
    – Ross Millikan
    Feb 15 at 21:43






  • 1




    $begingroup$
    I'll check it out. Thank you
    $endgroup$
    – Makina
    Feb 15 at 21:50
















1












$begingroup$


I stumbled upon Kelly bet during studies and decided to try simulating it. I chose a simple example where $b = 1$ and $p = 0.6$, which gave me the Kelly bet equal to $0.2$ of the wealth. I took $25$ dollars as a starting wealth and did $10000$ simulations of a $300$ bet game with $11$ possible bets including the Kelly bet, starting from $0$ (yeah, I did get $25$ average in the end, just wanted to make sure my program worked) with increment $0.1$ up to $1.0$ of starting wealth (i.e. full $25$ bet from the get go)



The resulting wealth turned out to be abit unintuitive to me: here is the list of wealths for each bet, i.e $25.0$ is for the bet = $0$ of starting wealth, $9789.283$ is for bet = $0.1$ of starting wealth.



[$25.0, 9789.283, 4322833.16, 68980116.885, 1665088721.462, 92284022.736, 19489.665, 0.012, 0.0, 0.0, 0.0$]



Kelly bet corresponds to $4322833.16$, whichis not the max value for the given bets. It turned out that $0.5$ is the best and $0.2$ is not even close.



Why is it like that? Could someone show an intuitive or direct mathematical reason for this or give me some hints.



Thank you very much



edit: added code in python



import random

N = 300
x = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
b = 1
p = 0.6
Iter_cnt = 10000

wealthlist = []
win_rate = 0

def gamble(bet_ratio, prob, win_multi, totalbets):
wealth = 25
wincnt = 0
for i in range(totalbets):
rnd = random.uniform(0, 1) #random real in (0, 1)
if rnd >= 1 - prob: #if win
wincnt += 1
wealth *= 1+win_multi*bet_ratio
else: #if lose
wealth *= (1-bet_ratio)

return (wealth, wincnt/totalbets) #return of a tuple with 1st argument being equal to resulting wealth and 2nd argument equal to the ratio for this simulation

avg_res_1bet = 0
avg_wr = 0

for i in x: #iterate over the list of betting ratios
for j in range(Iter_cnt): #iterate as many times as the value of Iter_cnt
avg_res_1bet += gamble(i, p, b, N)[0]/Iter_cnt #calculates the average result for each of the betting ratios
avg_wr += gamble(i, p, b, N)[1]/(Iter_cnt*len(x)) #calculates the average winrate of all simulations

wealthlist.append(round(avg_res_1bet,3)) #adds the resulting wealth to the final list, rounded to 3 decimals
avg_res_1bet = 0 #have to nullify in order to make the above command work properly


print("Sample win ratio is: {}".format(avg_wr)) #output
print("Final wealth is: {}".format(wealthlist)) #output









share|cite|improve this question











$endgroup$












  • $begingroup$
    What were the $11$ possible bets?
    $endgroup$
    – saulspatz
    Feb 15 at 20:50






  • 1




    $begingroup$
    $0.0, 0.1, 0.2 ... 0.9$ and $1.0$ of the starting wealth. I.e. $0, 2.5, 5... 22.5$ and $25$
    $endgroup$
    – Makina
    Feb 15 at 20:52












  • $begingroup$
    I think 300 bets is too small. If you up the number of bets (say, 3000), it's much more likely you'll see the correct behavior.
    $endgroup$
    – user113102
    Feb 15 at 21:38










  • $begingroup$
    Your values are far too large. I have checked saulspatz' result for 178 wins and you wind up with 4668.53 as he says. There is something wrong with your program
    $endgroup$
    – Ross Millikan
    Feb 15 at 21:43






  • 1




    $begingroup$
    I'll check it out. Thank you
    $endgroup$
    – Makina
    Feb 15 at 21:50














1












1








1





$begingroup$


I stumbled upon Kelly bet during studies and decided to try simulating it. I chose a simple example where $b = 1$ and $p = 0.6$, which gave me the Kelly bet equal to $0.2$ of the wealth. I took $25$ dollars as a starting wealth and did $10000$ simulations of a $300$ bet game with $11$ possible bets including the Kelly bet, starting from $0$ (yeah, I did get $25$ average in the end, just wanted to make sure my program worked) with increment $0.1$ up to $1.0$ of starting wealth (i.e. full $25$ bet from the get go)



The resulting wealth turned out to be abit unintuitive to me: here is the list of wealths for each bet, i.e $25.0$ is for the bet = $0$ of starting wealth, $9789.283$ is for bet = $0.1$ of starting wealth.



[$25.0, 9789.283, 4322833.16, 68980116.885, 1665088721.462, 92284022.736, 19489.665, 0.012, 0.0, 0.0, 0.0$]



Kelly bet corresponds to $4322833.16$, whichis not the max value for the given bets. It turned out that $0.5$ is the best and $0.2$ is not even close.



Why is it like that? Could someone show an intuitive or direct mathematical reason for this or give me some hints.



Thank you very much



edit: added code in python



import random

N = 300
x = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
b = 1
p = 0.6
Iter_cnt = 10000

wealthlist = []
win_rate = 0

def gamble(bet_ratio, prob, win_multi, totalbets):
wealth = 25
wincnt = 0
for i in range(totalbets):
rnd = random.uniform(0, 1) #random real in (0, 1)
if rnd >= 1 - prob: #if win
wincnt += 1
wealth *= 1+win_multi*bet_ratio
else: #if lose
wealth *= (1-bet_ratio)

return (wealth, wincnt/totalbets) #return of a tuple with 1st argument being equal to resulting wealth and 2nd argument equal to the ratio for this simulation

avg_res_1bet = 0
avg_wr = 0

for i in x: #iterate over the list of betting ratios
for j in range(Iter_cnt): #iterate as many times as the value of Iter_cnt
avg_res_1bet += gamble(i, p, b, N)[0]/Iter_cnt #calculates the average result for each of the betting ratios
avg_wr += gamble(i, p, b, N)[1]/(Iter_cnt*len(x)) #calculates the average winrate of all simulations

wealthlist.append(round(avg_res_1bet,3)) #adds the resulting wealth to the final list, rounded to 3 decimals
avg_res_1bet = 0 #have to nullify in order to make the above command work properly


print("Sample win ratio is: {}".format(avg_wr)) #output
print("Final wealth is: {}".format(wealthlist)) #output









share|cite|improve this question











$endgroup$




I stumbled upon Kelly bet during studies and decided to try simulating it. I chose a simple example where $b = 1$ and $p = 0.6$, which gave me the Kelly bet equal to $0.2$ of the wealth. I took $25$ dollars as a starting wealth and did $10000$ simulations of a $300$ bet game with $11$ possible bets including the Kelly bet, starting from $0$ (yeah, I did get $25$ average in the end, just wanted to make sure my program worked) with increment $0.1$ up to $1.0$ of starting wealth (i.e. full $25$ bet from the get go)



The resulting wealth turned out to be abit unintuitive to me: here is the list of wealths for each bet, i.e $25.0$ is for the bet = $0$ of starting wealth, $9789.283$ is for bet = $0.1$ of starting wealth.



[$25.0, 9789.283, 4322833.16, 68980116.885, 1665088721.462, 92284022.736, 19489.665, 0.012, 0.0, 0.0, 0.0$]



Kelly bet corresponds to $4322833.16$, whichis not the max value for the given bets. It turned out that $0.5$ is the best and $0.2$ is not even close.



Why is it like that? Could someone show an intuitive or direct mathematical reason for this or give me some hints.



Thank you very much



edit: added code in python



import random

N = 300
x = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
b = 1
p = 0.6
Iter_cnt = 10000

wealthlist = []
win_rate = 0

def gamble(bet_ratio, prob, win_multi, totalbets):
wealth = 25
wincnt = 0
for i in range(totalbets):
rnd = random.uniform(0, 1) #random real in (0, 1)
if rnd >= 1 - prob: #if win
wincnt += 1
wealth *= 1+win_multi*bet_ratio
else: #if lose
wealth *= (1-bet_ratio)

return (wealth, wincnt/totalbets) #return of a tuple with 1st argument being equal to resulting wealth and 2nd argument equal to the ratio for this simulation

avg_res_1bet = 0
avg_wr = 0

for i in x: #iterate over the list of betting ratios
for j in range(Iter_cnt): #iterate as many times as the value of Iter_cnt
avg_res_1bet += gamble(i, p, b, N)[0]/Iter_cnt #calculates the average result for each of the betting ratios
avg_wr += gamble(i, p, b, N)[1]/(Iter_cnt*len(x)) #calculates the average winrate of all simulations

wealthlist.append(round(avg_res_1bet,3)) #adds the resulting wealth to the final list, rounded to 3 decimals
avg_res_1bet = 0 #have to nullify in order to make the above command work properly


print("Sample win ratio is: {}".format(avg_wr)) #output
print("Final wealth is: {}".format(wealthlist)) #output






probability probability-distributions finance






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Feb 15 at 21:35







Makina

















asked Feb 15 at 20:45









MakinaMakina

1,1801316




1,1801316












  • $begingroup$
    What were the $11$ possible bets?
    $endgroup$
    – saulspatz
    Feb 15 at 20:50






  • 1




    $begingroup$
    $0.0, 0.1, 0.2 ... 0.9$ and $1.0$ of the starting wealth. I.e. $0, 2.5, 5... 22.5$ and $25$
    $endgroup$
    – Makina
    Feb 15 at 20:52












  • $begingroup$
    I think 300 bets is too small. If you up the number of bets (say, 3000), it's much more likely you'll see the correct behavior.
    $endgroup$
    – user113102
    Feb 15 at 21:38










  • $begingroup$
    Your values are far too large. I have checked saulspatz' result for 178 wins and you wind up with 4668.53 as he says. There is something wrong with your program
    $endgroup$
    – Ross Millikan
    Feb 15 at 21:43






  • 1




    $begingroup$
    I'll check it out. Thank you
    $endgroup$
    – Makina
    Feb 15 at 21:50


















  • $begingroup$
    What were the $11$ possible bets?
    $endgroup$
    – saulspatz
    Feb 15 at 20:50






  • 1




    $begingroup$
    $0.0, 0.1, 0.2 ... 0.9$ and $1.0$ of the starting wealth. I.e. $0, 2.5, 5... 22.5$ and $25$
    $endgroup$
    – Makina
    Feb 15 at 20:52












  • $begingroup$
    I think 300 bets is too small. If you up the number of bets (say, 3000), it's much more likely you'll see the correct behavior.
    $endgroup$
    – user113102
    Feb 15 at 21:38










  • $begingroup$
    Your values are far too large. I have checked saulspatz' result for 178 wins and you wind up with 4668.53 as he says. There is something wrong with your program
    $endgroup$
    – Ross Millikan
    Feb 15 at 21:43






  • 1




    $begingroup$
    I'll check it out. Thank you
    $endgroup$
    – Makina
    Feb 15 at 21:50
















$begingroup$
What were the $11$ possible bets?
$endgroup$
– saulspatz
Feb 15 at 20:50




$begingroup$
What were the $11$ possible bets?
$endgroup$
– saulspatz
Feb 15 at 20:50




1




1




$begingroup$
$0.0, 0.1, 0.2 ... 0.9$ and $1.0$ of the starting wealth. I.e. $0, 2.5, 5... 22.5$ and $25$
$endgroup$
– Makina
Feb 15 at 20:52






$begingroup$
$0.0, 0.1, 0.2 ... 0.9$ and $1.0$ of the starting wealth. I.e. $0, 2.5, 5... 22.5$ and $25$
$endgroup$
– Makina
Feb 15 at 20:52














$begingroup$
I think 300 bets is too small. If you up the number of bets (say, 3000), it's much more likely you'll see the correct behavior.
$endgroup$
– user113102
Feb 15 at 21:38




$begingroup$
I think 300 bets is too small. If you up the number of bets (say, 3000), it's much more likely you'll see the correct behavior.
$endgroup$
– user113102
Feb 15 at 21:38












$begingroup$
Your values are far too large. I have checked saulspatz' result for 178 wins and you wind up with 4668.53 as he says. There is something wrong with your program
$endgroup$
– Ross Millikan
Feb 15 at 21:43




$begingroup$
Your values are far too large. I have checked saulspatz' result for 178 wins and you wind up with 4668.53 as he says. There is something wrong with your program
$endgroup$
– Ross Millikan
Feb 15 at 21:43




1




1




$begingroup$
I'll check it out. Thank you
$endgroup$
– Makina
Feb 15 at 21:50




$begingroup$
I'll check it out. Thank you
$endgroup$
– Makina
Feb 15 at 21:50










2 Answers
2






active

oldest

votes


















2












$begingroup$

I think there must be something wrong with your program. I wrote a python script to try to duplicate your results, and $20%$ consistently comes out best. Here's my script:



from random import random, seed

seed()
frac = [k/10 for k in range(11)]
bankrolls = 11*[25]
wins = 0
for _ in range(300):
bets = [f*b for (f,b) in zip(frac, bankrolls)]
win = random() <= .6
if win:
wins += 1
bankrolls = [r+b for (r,b) in zip(bankrolls, bets)]
else:
bankrolls = [r-b for (r,b) in zip(bankrolls, bets)]

print(wins, "wins")
for idx, b in enumerate(bankrolls):
print(idx, b)


Here is sample output:



178 wins
0 25.0
1 1525.5418231115136
2 4668.530690514337
3 605.0866915333761
4 2.2038544365635504
5 0.00010387825597102039
6 1.5227053142812533e-11
7 4.2329300312072035e-22
8 3.648424706789544e-39
9 1.0377218907500444e-71
10 0.0


EDIT



I can't find an error in your code, but both our scripts are rather silly. If you start with a bankroll of $B,$ win $W$ times and lose $L$ times, then your bankroll at the end is $B(1+r)^W(1-r)^L$ where $r$ is the percentage you bet each hand. There is no need to do simulations.



You can experiment and see that the ending bankroll is highly sensitive to $W$. With $r=.2,$ an initial bankroll of 25, and $300$ total bets, $W=170$ gives an ending bankroll of $182.16,$ and $W=190$ gives an ending bankroll of $605724.76.$ (Note that the standard deviation of the number of wins is $sqrt{72}approx8.5$ so these are not outlandish outcomes.)



I think the flaw in your program is that you are running different simulations for each betting rate. Since the number of wins is not the same for the various regimes, the outcome aren't comparable.



It would be more informative to simply make a table comparing the ending bankroll for different betting ratios and numbers of wins.



Thank you for posting this question. I'd never heard of the Kelly bet before. I'd be interested to know if there are studies taking the probability of ruin into account. For example, if the bettor is a bank or an insurance company say, and it has a string of losses, its reserves will fall below the statutory minimum long before it loses all it capital, and the appropriate regulatory authority will shut it down. How should this be reflected in choosing the optimum bet? For an individual gambler, it's easy to say, "When you've lost all can afford to, go home," but a financial institution can't do that.






share|cite|improve this answer











$endgroup$









  • 1




    $begingroup$
    Thank you for your input. I added my code. Not as pythonic as yours, truly. I can't find the mistake in my code though ...
    $endgroup$
    – Makina
    Feb 15 at 21:36



















0












$begingroup$

The notion of taking the average of 10,000 simulations is foreign to Kelly. If you wanted to do it that way, you should have taken the geometric mean, not the arithmetic mean, or equivalently (to avoid numeric overflow) averaged the logs of the wealth, then taken the antilog of the average.



Or you could have just done one simulation of 3,000,000 trials, rather than the geometric mean of 10,000 simulations of 300 trials. The two are identical, Kelly-wise, as long as you express the results in the same units.



Your program did exactly what you wanted it to do. The results are still highly instructive, just not Kelly. They are discussed in comments so as not to clutter this answer.






share|cite|improve this answer










New contributor




Justin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$













  • $begingroup$
    By averaging over 10,000 trials, you are calculating the Expected Value of the wealth. EV is the arithmetic mean. Kelly does not maximise EV. (It maximises the geometric mean.) If you wanted to maximise EV, you would just bet 100% of your bank each time. The EV would then be 25 * 2^300 * (0.6)^300 = 1.42E+25 This is the value you would have got in the last column if only you had done enough simulations! But that would have taken rather longer.
    $endgroup$
    – Justin
    yesterday










  • $begingroup$
    In practice, when devising a strategy, it is far more useful to know that in 10,000 trials your return was zero 10,000 times running, than it is to know that your EV was actually 14 trillion trillion dollars all along. That's why you use Kelly.
    $endgroup$
    – Justin
    yesterday










  • $begingroup$
    OP's results, though wildly different from saulspatz, are indeed exactly what you would expect from averaging 10,000 saulspatz runs. The outliers raise the average.
    $endgroup$
    – Justin
    yesterday










  • $begingroup$
    saulspatz gave the results of a single simulation of 300 bets with an observed win rate very close to 0.6, so it's no surprise that the results align with Kelly. That is a typical result. OP gave the average of 10,000 simulations of 300 bets, so OP's results are closer to the EV, which is NOT typical(!) As evident from the extreme example above, for large %bet the EV is far higher than any result that you would ever actually observe in less than the age of the universe. To all intents and purposes, the 100% bet EV over 300 trials is meaningless.
    $endgroup$
    – Justin
    yesterday











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3114387%2fkelly-bet-question%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









2












$begingroup$

I think there must be something wrong with your program. I wrote a python script to try to duplicate your results, and $20%$ consistently comes out best. Here's my script:



from random import random, seed

seed()
frac = [k/10 for k in range(11)]
bankrolls = 11*[25]
wins = 0
for _ in range(300):
bets = [f*b for (f,b) in zip(frac, bankrolls)]
win = random() <= .6
if win:
wins += 1
bankrolls = [r+b for (r,b) in zip(bankrolls, bets)]
else:
bankrolls = [r-b for (r,b) in zip(bankrolls, bets)]

print(wins, "wins")
for idx, b in enumerate(bankrolls):
print(idx, b)


Here is sample output:



178 wins
0 25.0
1 1525.5418231115136
2 4668.530690514337
3 605.0866915333761
4 2.2038544365635504
5 0.00010387825597102039
6 1.5227053142812533e-11
7 4.2329300312072035e-22
8 3.648424706789544e-39
9 1.0377218907500444e-71
10 0.0


EDIT



I can't find an error in your code, but both our scripts are rather silly. If you start with a bankroll of $B,$ win $W$ times and lose $L$ times, then your bankroll at the end is $B(1+r)^W(1-r)^L$ where $r$ is the percentage you bet each hand. There is no need to do simulations.



You can experiment and see that the ending bankroll is highly sensitive to $W$. With $r=.2,$ an initial bankroll of 25, and $300$ total bets, $W=170$ gives an ending bankroll of $182.16,$ and $W=190$ gives an ending bankroll of $605724.76.$ (Note that the standard deviation of the number of wins is $sqrt{72}approx8.5$ so these are not outlandish outcomes.)



I think the flaw in your program is that you are running different simulations for each betting rate. Since the number of wins is not the same for the various regimes, the outcome aren't comparable.



It would be more informative to simply make a table comparing the ending bankroll for different betting ratios and numbers of wins.



Thank you for posting this question. I'd never heard of the Kelly bet before. I'd be interested to know if there are studies taking the probability of ruin into account. For example, if the bettor is a bank or an insurance company say, and it has a string of losses, its reserves will fall below the statutory minimum long before it loses all it capital, and the appropriate regulatory authority will shut it down. How should this be reflected in choosing the optimum bet? For an individual gambler, it's easy to say, "When you've lost all can afford to, go home," but a financial institution can't do that.






share|cite|improve this answer











$endgroup$









  • 1




    $begingroup$
    Thank you for your input. I added my code. Not as pythonic as yours, truly. I can't find the mistake in my code though ...
    $endgroup$
    – Makina
    Feb 15 at 21:36
















2












$begingroup$

I think there must be something wrong with your program. I wrote a python script to try to duplicate your results, and $20%$ consistently comes out best. Here's my script:



from random import random, seed

seed()
frac = [k/10 for k in range(11)]
bankrolls = 11*[25]
wins = 0
for _ in range(300):
bets = [f*b for (f,b) in zip(frac, bankrolls)]
win = random() <= .6
if win:
wins += 1
bankrolls = [r+b for (r,b) in zip(bankrolls, bets)]
else:
bankrolls = [r-b for (r,b) in zip(bankrolls, bets)]

print(wins, "wins")
for idx, b in enumerate(bankrolls):
print(idx, b)


Here is sample output:



178 wins
0 25.0
1 1525.5418231115136
2 4668.530690514337
3 605.0866915333761
4 2.2038544365635504
5 0.00010387825597102039
6 1.5227053142812533e-11
7 4.2329300312072035e-22
8 3.648424706789544e-39
9 1.0377218907500444e-71
10 0.0


EDIT



I can't find an error in your code, but both our scripts are rather silly. If you start with a bankroll of $B,$ win $W$ times and lose $L$ times, then your bankroll at the end is $B(1+r)^W(1-r)^L$ where $r$ is the percentage you bet each hand. There is no need to do simulations.



You can experiment and see that the ending bankroll is highly sensitive to $W$. With $r=.2,$ an initial bankroll of 25, and $300$ total bets, $W=170$ gives an ending bankroll of $182.16,$ and $W=190$ gives an ending bankroll of $605724.76.$ (Note that the standard deviation of the number of wins is $sqrt{72}approx8.5$ so these are not outlandish outcomes.)



I think the flaw in your program is that you are running different simulations for each betting rate. Since the number of wins is not the same for the various regimes, the outcome aren't comparable.



It would be more informative to simply make a table comparing the ending bankroll for different betting ratios and numbers of wins.



Thank you for posting this question. I'd never heard of the Kelly bet before. I'd be interested to know if there are studies taking the probability of ruin into account. For example, if the bettor is a bank or an insurance company say, and it has a string of losses, its reserves will fall below the statutory minimum long before it loses all it capital, and the appropriate regulatory authority will shut it down. How should this be reflected in choosing the optimum bet? For an individual gambler, it's easy to say, "When you've lost all can afford to, go home," but a financial institution can't do that.






share|cite|improve this answer











$endgroup$









  • 1




    $begingroup$
    Thank you for your input. I added my code. Not as pythonic as yours, truly. I can't find the mistake in my code though ...
    $endgroup$
    – Makina
    Feb 15 at 21:36














2












2








2





$begingroup$

I think there must be something wrong with your program. I wrote a python script to try to duplicate your results, and $20%$ consistently comes out best. Here's my script:



from random import random, seed

seed()
frac = [k/10 for k in range(11)]
bankrolls = 11*[25]
wins = 0
for _ in range(300):
bets = [f*b for (f,b) in zip(frac, bankrolls)]
win = random() <= .6
if win:
wins += 1
bankrolls = [r+b for (r,b) in zip(bankrolls, bets)]
else:
bankrolls = [r-b for (r,b) in zip(bankrolls, bets)]

print(wins, "wins")
for idx, b in enumerate(bankrolls):
print(idx, b)


Here is sample output:



178 wins
0 25.0
1 1525.5418231115136
2 4668.530690514337
3 605.0866915333761
4 2.2038544365635504
5 0.00010387825597102039
6 1.5227053142812533e-11
7 4.2329300312072035e-22
8 3.648424706789544e-39
9 1.0377218907500444e-71
10 0.0


EDIT



I can't find an error in your code, but both our scripts are rather silly. If you start with a bankroll of $B,$ win $W$ times and lose $L$ times, then your bankroll at the end is $B(1+r)^W(1-r)^L$ where $r$ is the percentage you bet each hand. There is no need to do simulations.



You can experiment and see that the ending bankroll is highly sensitive to $W$. With $r=.2,$ an initial bankroll of 25, and $300$ total bets, $W=170$ gives an ending bankroll of $182.16,$ and $W=190$ gives an ending bankroll of $605724.76.$ (Note that the standard deviation of the number of wins is $sqrt{72}approx8.5$ so these are not outlandish outcomes.)



I think the flaw in your program is that you are running different simulations for each betting rate. Since the number of wins is not the same for the various regimes, the outcome aren't comparable.



It would be more informative to simply make a table comparing the ending bankroll for different betting ratios and numbers of wins.



Thank you for posting this question. I'd never heard of the Kelly bet before. I'd be interested to know if there are studies taking the probability of ruin into account. For example, if the bettor is a bank or an insurance company say, and it has a string of losses, its reserves will fall below the statutory minimum long before it loses all it capital, and the appropriate regulatory authority will shut it down. How should this be reflected in choosing the optimum bet? For an individual gambler, it's easy to say, "When you've lost all can afford to, go home," but a financial institution can't do that.






share|cite|improve this answer











$endgroup$



I think there must be something wrong with your program. I wrote a python script to try to duplicate your results, and $20%$ consistently comes out best. Here's my script:



from random import random, seed

seed()
frac = [k/10 for k in range(11)]
bankrolls = 11*[25]
wins = 0
for _ in range(300):
bets = [f*b for (f,b) in zip(frac, bankrolls)]
win = random() <= .6
if win:
wins += 1
bankrolls = [r+b for (r,b) in zip(bankrolls, bets)]
else:
bankrolls = [r-b for (r,b) in zip(bankrolls, bets)]

print(wins, "wins")
for idx, b in enumerate(bankrolls):
print(idx, b)


Here is sample output:



178 wins
0 25.0
1 1525.5418231115136
2 4668.530690514337
3 605.0866915333761
4 2.2038544365635504
5 0.00010387825597102039
6 1.5227053142812533e-11
7 4.2329300312072035e-22
8 3.648424706789544e-39
9 1.0377218907500444e-71
10 0.0


EDIT



I can't find an error in your code, but both our scripts are rather silly. If you start with a bankroll of $B,$ win $W$ times and lose $L$ times, then your bankroll at the end is $B(1+r)^W(1-r)^L$ where $r$ is the percentage you bet each hand. There is no need to do simulations.



You can experiment and see that the ending bankroll is highly sensitive to $W$. With $r=.2,$ an initial bankroll of 25, and $300$ total bets, $W=170$ gives an ending bankroll of $182.16,$ and $W=190$ gives an ending bankroll of $605724.76.$ (Note that the standard deviation of the number of wins is $sqrt{72}approx8.5$ so these are not outlandish outcomes.)



I think the flaw in your program is that you are running different simulations for each betting rate. Since the number of wins is not the same for the various regimes, the outcome aren't comparable.



It would be more informative to simply make a table comparing the ending bankroll for different betting ratios and numbers of wins.



Thank you for posting this question. I'd never heard of the Kelly bet before. I'd be interested to know if there are studies taking the probability of ruin into account. For example, if the bettor is a bank or an insurance company say, and it has a string of losses, its reserves will fall below the statutory minimum long before it loses all it capital, and the appropriate regulatory authority will shut it down. How should this be reflected in choosing the optimum bet? For an individual gambler, it's easy to say, "When you've lost all can afford to, go home," but a financial institution can't do that.







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited Feb 15 at 23:59

























answered Feb 15 at 21:17









saulspatzsaulspatz

16.7k31333




16.7k31333








  • 1




    $begingroup$
    Thank you for your input. I added my code. Not as pythonic as yours, truly. I can't find the mistake in my code though ...
    $endgroup$
    – Makina
    Feb 15 at 21:36














  • 1




    $begingroup$
    Thank you for your input. I added my code. Not as pythonic as yours, truly. I can't find the mistake in my code though ...
    $endgroup$
    – Makina
    Feb 15 at 21:36








1




1




$begingroup$
Thank you for your input. I added my code. Not as pythonic as yours, truly. I can't find the mistake in my code though ...
$endgroup$
– Makina
Feb 15 at 21:36




$begingroup$
Thank you for your input. I added my code. Not as pythonic as yours, truly. I can't find the mistake in my code though ...
$endgroup$
– Makina
Feb 15 at 21:36











0












$begingroup$

The notion of taking the average of 10,000 simulations is foreign to Kelly. If you wanted to do it that way, you should have taken the geometric mean, not the arithmetic mean, or equivalently (to avoid numeric overflow) averaged the logs of the wealth, then taken the antilog of the average.



Or you could have just done one simulation of 3,000,000 trials, rather than the geometric mean of 10,000 simulations of 300 trials. The two are identical, Kelly-wise, as long as you express the results in the same units.



Your program did exactly what you wanted it to do. The results are still highly instructive, just not Kelly. They are discussed in comments so as not to clutter this answer.






share|cite|improve this answer










New contributor




Justin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$













  • $begingroup$
    By averaging over 10,000 trials, you are calculating the Expected Value of the wealth. EV is the arithmetic mean. Kelly does not maximise EV. (It maximises the geometric mean.) If you wanted to maximise EV, you would just bet 100% of your bank each time. The EV would then be 25 * 2^300 * (0.6)^300 = 1.42E+25 This is the value you would have got in the last column if only you had done enough simulations! But that would have taken rather longer.
    $endgroup$
    – Justin
    yesterday










  • $begingroup$
    In practice, when devising a strategy, it is far more useful to know that in 10,000 trials your return was zero 10,000 times running, than it is to know that your EV was actually 14 trillion trillion dollars all along. That's why you use Kelly.
    $endgroup$
    – Justin
    yesterday










  • $begingroup$
    OP's results, though wildly different from saulspatz, are indeed exactly what you would expect from averaging 10,000 saulspatz runs. The outliers raise the average.
    $endgroup$
    – Justin
    yesterday










  • $begingroup$
    saulspatz gave the results of a single simulation of 300 bets with an observed win rate very close to 0.6, so it's no surprise that the results align with Kelly. That is a typical result. OP gave the average of 10,000 simulations of 300 bets, so OP's results are closer to the EV, which is NOT typical(!) As evident from the extreme example above, for large %bet the EV is far higher than any result that you would ever actually observe in less than the age of the universe. To all intents and purposes, the 100% bet EV over 300 trials is meaningless.
    $endgroup$
    – Justin
    yesterday
















0












$begingroup$

The notion of taking the average of 10,000 simulations is foreign to Kelly. If you wanted to do it that way, you should have taken the geometric mean, not the arithmetic mean, or equivalently (to avoid numeric overflow) averaged the logs of the wealth, then taken the antilog of the average.



Or you could have just done one simulation of 3,000,000 trials, rather than the geometric mean of 10,000 simulations of 300 trials. The two are identical, Kelly-wise, as long as you express the results in the same units.



Your program did exactly what you wanted it to do. The results are still highly instructive, just not Kelly. They are discussed in comments so as not to clutter this answer.






share|cite|improve this answer










New contributor




Justin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$













  • $begingroup$
    By averaging over 10,000 trials, you are calculating the Expected Value of the wealth. EV is the arithmetic mean. Kelly does not maximise EV. (It maximises the geometric mean.) If you wanted to maximise EV, you would just bet 100% of your bank each time. The EV would then be 25 * 2^300 * (0.6)^300 = 1.42E+25 This is the value you would have got in the last column if only you had done enough simulations! But that would have taken rather longer.
    $endgroup$
    – Justin
    yesterday










  • $begingroup$
    In practice, when devising a strategy, it is far more useful to know that in 10,000 trials your return was zero 10,000 times running, than it is to know that your EV was actually 14 trillion trillion dollars all along. That's why you use Kelly.
    $endgroup$
    – Justin
    yesterday










  • $begingroup$
    OP's results, though wildly different from saulspatz, are indeed exactly what you would expect from averaging 10,000 saulspatz runs. The outliers raise the average.
    $endgroup$
    – Justin
    yesterday










  • $begingroup$
    saulspatz gave the results of a single simulation of 300 bets with an observed win rate very close to 0.6, so it's no surprise that the results align with Kelly. That is a typical result. OP gave the average of 10,000 simulations of 300 bets, so OP's results are closer to the EV, which is NOT typical(!) As evident from the extreme example above, for large %bet the EV is far higher than any result that you would ever actually observe in less than the age of the universe. To all intents and purposes, the 100% bet EV over 300 trials is meaningless.
    $endgroup$
    – Justin
    yesterday














0












0








0





$begingroup$

The notion of taking the average of 10,000 simulations is foreign to Kelly. If you wanted to do it that way, you should have taken the geometric mean, not the arithmetic mean, or equivalently (to avoid numeric overflow) averaged the logs of the wealth, then taken the antilog of the average.



Or you could have just done one simulation of 3,000,000 trials, rather than the geometric mean of 10,000 simulations of 300 trials. The two are identical, Kelly-wise, as long as you express the results in the same units.



Your program did exactly what you wanted it to do. The results are still highly instructive, just not Kelly. They are discussed in comments so as not to clutter this answer.






share|cite|improve this answer










New contributor




Justin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$



The notion of taking the average of 10,000 simulations is foreign to Kelly. If you wanted to do it that way, you should have taken the geometric mean, not the arithmetic mean, or equivalently (to avoid numeric overflow) averaged the logs of the wealth, then taken the antilog of the average.



Or you could have just done one simulation of 3,000,000 trials, rather than the geometric mean of 10,000 simulations of 300 trials. The two are identical, Kelly-wise, as long as you express the results in the same units.



Your program did exactly what you wanted it to do. The results are still highly instructive, just not Kelly. They are discussed in comments so as not to clutter this answer.







share|cite|improve this answer










New contributor




Justin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|cite|improve this answer



share|cite|improve this answer








edited yesterday





















New contributor




Justin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









answered 2 days ago









JustinJustin

92




92




New contributor




Justin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Justin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Justin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • $begingroup$
    By averaging over 10,000 trials, you are calculating the Expected Value of the wealth. EV is the arithmetic mean. Kelly does not maximise EV. (It maximises the geometric mean.) If you wanted to maximise EV, you would just bet 100% of your bank each time. The EV would then be 25 * 2^300 * (0.6)^300 = 1.42E+25 This is the value you would have got in the last column if only you had done enough simulations! But that would have taken rather longer.
    $endgroup$
    – Justin
    yesterday










  • $begingroup$
    In practice, when devising a strategy, it is far more useful to know that in 10,000 trials your return was zero 10,000 times running, than it is to know that your EV was actually 14 trillion trillion dollars all along. That's why you use Kelly.
    $endgroup$
    – Justin
    yesterday










  • $begingroup$
    OP's results, though wildly different from saulspatz, are indeed exactly what you would expect from averaging 10,000 saulspatz runs. The outliers raise the average.
    $endgroup$
    – Justin
    yesterday










  • $begingroup$
    saulspatz gave the results of a single simulation of 300 bets with an observed win rate very close to 0.6, so it's no surprise that the results align with Kelly. That is a typical result. OP gave the average of 10,000 simulations of 300 bets, so OP's results are closer to the EV, which is NOT typical(!) As evident from the extreme example above, for large %bet the EV is far higher than any result that you would ever actually observe in less than the age of the universe. To all intents and purposes, the 100% bet EV over 300 trials is meaningless.
    $endgroup$
    – Justin
    yesterday


















  • $begingroup$
    By averaging over 10,000 trials, you are calculating the Expected Value of the wealth. EV is the arithmetic mean. Kelly does not maximise EV. (It maximises the geometric mean.) If you wanted to maximise EV, you would just bet 100% of your bank each time. The EV would then be 25 * 2^300 * (0.6)^300 = 1.42E+25 This is the value you would have got in the last column if only you had done enough simulations! But that would have taken rather longer.
    $endgroup$
    – Justin
    yesterday










  • $begingroup$
    In practice, when devising a strategy, it is far more useful to know that in 10,000 trials your return was zero 10,000 times running, than it is to know that your EV was actually 14 trillion trillion dollars all along. That's why you use Kelly.
    $endgroup$
    – Justin
    yesterday










  • $begingroup$
    OP's results, though wildly different from saulspatz, are indeed exactly what you would expect from averaging 10,000 saulspatz runs. The outliers raise the average.
    $endgroup$
    – Justin
    yesterday










  • $begingroup$
    saulspatz gave the results of a single simulation of 300 bets with an observed win rate very close to 0.6, so it's no surprise that the results align with Kelly. That is a typical result. OP gave the average of 10,000 simulations of 300 bets, so OP's results are closer to the EV, which is NOT typical(!) As evident from the extreme example above, for large %bet the EV is far higher than any result that you would ever actually observe in less than the age of the universe. To all intents and purposes, the 100% bet EV over 300 trials is meaningless.
    $endgroup$
    – Justin
    yesterday
















$begingroup$
By averaging over 10,000 trials, you are calculating the Expected Value of the wealth. EV is the arithmetic mean. Kelly does not maximise EV. (It maximises the geometric mean.) If you wanted to maximise EV, you would just bet 100% of your bank each time. The EV would then be 25 * 2^300 * (0.6)^300 = 1.42E+25 This is the value you would have got in the last column if only you had done enough simulations! But that would have taken rather longer.
$endgroup$
– Justin
yesterday




$begingroup$
By averaging over 10,000 trials, you are calculating the Expected Value of the wealth. EV is the arithmetic mean. Kelly does not maximise EV. (It maximises the geometric mean.) If you wanted to maximise EV, you would just bet 100% of your bank each time. The EV would then be 25 * 2^300 * (0.6)^300 = 1.42E+25 This is the value you would have got in the last column if only you had done enough simulations! But that would have taken rather longer.
$endgroup$
– Justin
yesterday












$begingroup$
In practice, when devising a strategy, it is far more useful to know that in 10,000 trials your return was zero 10,000 times running, than it is to know that your EV was actually 14 trillion trillion dollars all along. That's why you use Kelly.
$endgroup$
– Justin
yesterday




$begingroup$
In practice, when devising a strategy, it is far more useful to know that in 10,000 trials your return was zero 10,000 times running, than it is to know that your EV was actually 14 trillion trillion dollars all along. That's why you use Kelly.
$endgroup$
– Justin
yesterday












$begingroup$
OP's results, though wildly different from saulspatz, are indeed exactly what you would expect from averaging 10,000 saulspatz runs. The outliers raise the average.
$endgroup$
– Justin
yesterday




$begingroup$
OP's results, though wildly different from saulspatz, are indeed exactly what you would expect from averaging 10,000 saulspatz runs. The outliers raise the average.
$endgroup$
– Justin
yesterday












$begingroup$
saulspatz gave the results of a single simulation of 300 bets with an observed win rate very close to 0.6, so it's no surprise that the results align with Kelly. That is a typical result. OP gave the average of 10,000 simulations of 300 bets, so OP's results are closer to the EV, which is NOT typical(!) As evident from the extreme example above, for large %bet the EV is far higher than any result that you would ever actually observe in less than the age of the universe. To all intents and purposes, the 100% bet EV over 300 trials is meaningless.
$endgroup$
– Justin
yesterday




$begingroup$
saulspatz gave the results of a single simulation of 300 bets with an observed win rate very close to 0.6, so it's no surprise that the results align with Kelly. That is a typical result. OP gave the average of 10,000 simulations of 300 bets, so OP's results are closer to the EV, which is NOT typical(!) As evident from the extreme example above, for large %bet the EV is far higher than any result that you would ever actually observe in less than the age of the universe. To all intents and purposes, the 100% bet EV over 300 trials is meaningless.
$endgroup$
– Justin
yesterday


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3114387%2fkelly-bet-question%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Nidaros erkebispedøme

Birsay

Where did Arya get these scars? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Favourite questions and answers from the 1st quarter of 2019Why did Arya refuse to end it?Has the pronunciation of Arya Stark's name changed?Has Arya forgiven people?Why did Arya Stark lose her vision?Why can Arya still use the faces?Has the Narrow Sea become narrower?Does Arya Stark know how to make poisons outside of the House of Black and White?Why did Nymeria leave Arya?Why did Arya not kill the Lannister soldiers she encountered in the Riverlands?What is the current canonical age of Sansa, Bran and Arya Stark?