This request for help is linked to another post, but I thought I'd make a new thread not to go off topic on the other one.
I need help making a Random Walk simulation in Excel in order to calculate the RoR of hole-carding Three Card Poker. Not because I want to play it (so please refrain from stories about the crazy variance) but because it's one of the only analyses I could find that also gives a result of 0.32% RoR for a 50k (250 unit) bankroll. I want to make a simulation to reach that same 0.32% that was published so I know I did everything correctly.
Mustangsally suggested I create a Markov chain and actually calculate the RoR, and I'm looking at that separately, but I would like to learn to make a simulation too. I do not know any programming language so I'd like to use Excel.
I made 2 types of simulations so far. One is a single line a random result (lose -2, lose -1, push, win 1, win 2, win 3, win 5, win 6, win 7) where if you press F9 you get a random hand everytime. This is helpful to some extent but I don't know how to extract an RoR from it.
Another one is a million rows of random hands (like the one above but on a million rows) where I can work out a bankroll progress graph, I could see how this would be better for working out RoR, but Excel's maximum is 1 Million rows and that's not really enough for a reliable simulation.
Anyone who does this frequently and can point me in the right direction?
Thank you
The messed up thing about ROR, when trying to calculate it via simulation, is that it means “the % chance to lose all your money, if you play forever”. If your ROR is 1%, then you have a 99% chance of playing forever and thus winning an infinite amount. So even if you turn a $10k BR into $20k and your ROR with $10k was 10%, at this new point, your ROR would be 1%. If you then doubled it again to $40k, your new ROR at this new point would be 0.01%.
Based on a 250 unit BR for a 0.32% ROR, if I did the math right, full kelly would be about 87.14 units.
a simulation also needs to be run many many times to get the error very very small or the sim data becomes a bit meaningless.Quote: gunbjMustangsally suggested I create a Markov chain and actually calculate the RoR, and I'm looking at that separately, but I would like to learn to make a simulation too. I do not know any programming language so I'd like to use Excel.
The Markov chain solution is actually very simple to use once one knows how to use it.
For me it took what seemed like forever, but there are websites that can walk one thru it.
I used this
http://www.zweigmedia.com/RealWorld/Summary6b.html
and other programs (currently using R) can do them way faster than Excel too.
sure can.Quote: gunbjAnyone who does this frequently and can point me in the right direction?
I have an Excel simulation sheet that uses vba (you do not need to know vba to use the sheet).
I can adjust it for 3CP and let you have at it and see how much fun you can have with it.
will pm you when completed
good luck
I must be fuzzy today but I've read this sentence like 3 times and I'm not quite sure what you mean. So for a 250 unit BR for a .32% RoR you could bet full kelly at ~87 units per hand? Or was the ~87 units based on his original OP or something?Quote: RS...Based on a 250 unit BR for a 0.32% ROR, if I did the math right, full kelly would be about 87.14 units.
not really.Quote: RSThe messed up thing about ROR, when trying to calculate it via simulation, is that it means “the % chance to lose all your money, if you play forever”.
most all RoR sims are two-sided barrier problems
having ruin and a target as stopping points.
sure there is a simple ror formula for playing forever (a few threads have it at WoV), but simulations can give lots more useful data, as you well know.
Plus, simulations can carry a lot of weight and are more impressive to many too than dry, cold and boring math.
I proved that to myself many years ago
nice observations
Using the Wizard’s page on hole-carding this game, I calculated the standard deviation as 1.74. The player edge is 3.5%.
So this game is statistically congruent to a binary game with a 0.26 chance of winning and a payout of 2.98 to 1.
In excel I ran 10,000 trials playing 70.000 hands per trial with a starting balance of 250 units. A loss is - 1 unit and a win is + 2.98 units. The chance of being anywhere close to zero after 70,000 hands is extremely remote (more than 5 standard deviations to the left of expectations).
39 of 10,000 trials did go to zero at some point. So the 0.32% figure for risk of ruin seems reasonable. This is for flat betting with the 250 units. 1 unit per bet.
The Kelly criterion suggests betting 1.17% of bankroll each bet, so opening bet of 2.93 units. Call it 3. There is no risk of ruin using Kelly.
Quote: 7crapsnot really.
most all RoR sims are two-sided barrier problems
having ruin and a target as stopping points.
sure there is a simple ror formula for playing forever (a few threads have it at WoV), but simulations can give lots more useful data, as you well know.
Plus, simulations can carry a lot of weight and are more impressive to many too than dry, cold and boring math.
I proved that to myself many years ago
nice observations
Hey, 7craps! Welcome back!
Quote: RomesI must be fuzzy today but I've read this sentence like 3 times and I'm not quite sure what you mean. So for a 250 unit BR for a .32% RoR you could bet full kelly at ~87 units per hand? Or was the ~87 units based on his original OP or something?
It's sorta like saying... "I simmed X game and with a $10k BR, I have an 8% ROR, therefore with a $20k BR, the ROR would be 0.08^2 = 0.64%".
IOW: If someone was betting full kelly, he'd be betting 1/87'th of his BR. This agrees with Ace2 when he said at full kelly you'd be betting 1.17% of your BR. 1/87 = 1.149% which is ~ 1.17%.
Quote: 7crapsnot really.
most all RoR sims are two-sided barrier problems
having ruin and a target as stopping points.
sure there is a simple ror formula for playing forever (a few threads have it at WoV), but simulations can give lots more useful data, as you well know.
Plus, simulations can carry a lot of weight and are more impressive to many too than dry, cold and boring math.
I proved that to myself many years ago
nice observations
Yes, of course there are different ways to define ROR. As I mentioned, it can be either used as "play forever", "play for X time [or rounds]", or "play until X happens (ie: BR is doubled", etc. But in the context of the OP, unless I misunderstood something, it seems like he wants to find the "play forever" ROR, which is the definition ROR is generally given, unless otherwise stipulated.
Without a doubt, if I'm going into a play I haven't done before or it's something "weird" and I need to do the math on it, then I too will try to determine the ROR (play forever) figure as well as a trip or session ROR, that way I'm not (severely) overfunded or overfunded for a trip or session. Another benefit of sims is being able to look at the random walk results and being like, "Eh, would I be able to stomach this kind of variance?" It's one thing to see an X% ROR, EV, or whatever else. It's a whole nother thing to see, "Oh, I could reasonably lose $XYZ in a session, hmmm...."
I believe the OP's intention of this thread is for academic purposes, to see if he can calculate the 'true' ROR for such a game with a given bankroll. It stems from another thread he made about it, talking about Teliot (Eliot Jacobson) 's story about his friend or someone that lost 250 units on HC TCP with a 0.32% ROR.
agree.Quote: Ace239 of 10,000 trials did go to zero at some point. So the 0.32% figure for risk of ruin seems reasonable. This is for flat betting with the 250 units. 1 unit per bet.
one can also use a well known formula found here with a few examples
(playing forever with an advantage. only ruin as a barrier)
Wizard Of Vegas Examples
for ruin: r = e^[(-2ev x B)/(s.d.)^2]
=0.3192%
parameters:
ev=.0348
sd=1.74
Bankroll=250
for Bankroll: B = [-(s.d.)^2 x ln r]/2ev
=-249.62
parameters:
r=0.3220%
ev=.0348
sd=1.74
Markov chain in R (has a target and ruin)
> ror.3cp(250,500) #turn 250 units into at least 500 units
[1] "3 card poker. Overshoot target possible"
data
stake 250.000000000
p(target) 0.996779348
p(ruin) 0.003220652
avg trials 7144.016356530
more tools for the tool box
Sally
yes, that was stated in his other thread.Quote: RSI believe the OP's intention of this thread is for academic purposes, to see if he can calculate the 'true' ROR for such a game with a given bankroll. It stems from another thread he made about it, talking about Teliot (Eliot Jacobson) 's story about his friend or someone that lost 250 units on HC TCP with a 0.32% ROR.
RoR still needs that payout distribution for calculating or simulation
and that is some different math that is different from looping and listing all possible outcomes and summing.
still arrives at equal answers as long as no mistakes were made.
Sally
Can you elaborate on the Markov chain method. I don’t follow how it could be used for this type of problem.Quote: mustangsally
Markov chain in R (has a target and ruin)> ror.3cp(250,500) #turn 250 units into at least 500 units
[1] "3 card poker. Overshoot target possible"
data
stake 250.000000000
p(target) 0.996779348
p(ruin) 0.003220652
avg trials 7144.016356530
more tools for the tool box
Sally
I do not understand your question.Quote: Ace2Can you elaborate on the Markov chain method. I don’t follow how it could be used for this type of problem.
the OP was looking for a solution in Excel using a simulation and has been shown that.
also a useful formula.
I just started with a basic attempt to double a start stake.
turn 250 into at least 500. super easy calculating it (and super fast)
we can expand that with a Markov chain (as you do understand)
to turn 250 into 600, into 750, into 1000 etc.
we would see the prob for ruin to be almost the same
or even
300 into 600
a calculation for this is way faster than a simulation
and more accurate than a sim, if that matters of course.
so I was just giving a starting point so the OP might understand better.
most would steer one away from doing a simulation in Excel
but it can be done and done correct (maybe a bit slower than other programs)
but that now all sounds confusing
Sally
I don’t understand how the Markov chain could be feasibly done. With a payout of 2.98 for a win and a range of 0 - 500 units, I think we’re talking about a 25,000 x 25,000 transition matrix (500 / .02). And would have to be run like 50,000 iterations.Quote: mustangsally
I just started with a basic attempt to double a start stake.
turn 250 into at least 500. super easy calculating it (and super fast)
we can expand that with a Markov chain (as you do understand)
to turn 250 into 600, into 750, into 1000 etc.
we would see the prob for ruin to be almost the same
Maybe you can post a doc of the calculation. I guess I’m missing something.
To clarify if you could, by statistically congruent, I assume that means in layman's terms -- you wouldn't be able to tell the difference between the two games if you played each of them? I can see the EV is the same for each (I did the math :] ). But would like, the swings, risk, etc. be identical on both games?
Knowing the SD and EV of the game you solve for p and payout.
(p x (1-p))^.5 x payout = 1.75.
p x payout = 1.035.
As a verification
(.26 x .74) ^ .5 x 3.98 = 1.75 SD rounded.
.26 x 3.98 = 1.035 EV rounded.
So analyzing the long term behavior of this game (the net result after x plays will be EV +/- SD) is like looking at a game with p = .26 and payout 3.98 for 1.
I get it now.Quote: Ace2I don’t understand how the Markov chain could be feasibly done. With a payout of 2.98 for a win and a range of 0 - 500 units, I think we’re talking about a 25,000 x 25,000 transition matrix (500 / .02). And would have to be run like 50,000 iterations.
Maybe you can post a doc of the calculation. I guess I’m missing something.
I did not use your data
the transition matrix used this distribution
L2 <- 138570276/407170400
L1 <- 47601384/407170400
W0 <- 229912/407170400
W1 <- 119271408/407170400
W2 <- 90682848/407170400
W3 <- 8976452/407170400
W4 <- 0
W5 <- 289104/407170400
W6 <- 931972/407170400
W7 <- 617044/407170400
The R code solution can be found here
https://sites.google.com/view/krapstuff/r-testing
the code can be run right in the webpage
It was made from a transition matrix 1st setup in Excel
here goes some results
I counted to 2 seconds and the results were completed
ror.3cp(250,500) #this means turning 250 units into at least 500 units
[1] 500 <<<this is the target
[1] 250 <<<this is the gain
> ror.3cp(250,500)
[1] "3 card poker. Overshoot target possible"
data
stake 250.000000000
p(target) 0.996779348
p(ruin) 0.003220652
avg trials 7144.016356530
[1] 500
[1] 250
> ror.3cp(250,600)
[1] "3 card poker. Overshoot target possible"
data
stake 250.000000000
p(target) 0.996770216
p(ruin) 0.003229784
avg trials 10005.813690248
[1] 600
[1] 350
> ror.3cp(250,700)
[1] "3 card poker. Overshoot target possible"
data
stake 250.000000000
p(target) 0.996769301
p(ruin) 0.003230699
avg trials 12867.723664022
[1] 700
[1] 450
> ror.3cp(250,800)
[1] "3 card poker. Overshoot target possible"
data
stake 250.000000000
p(target) 0.996769209
p(ruin) 0.003230791
avg trials 15729.647294715
[1] 800
[1] 550
> ror.3cp(250,900)
[1] "3 card poker. Overshoot target possible"
data
stake 250.0000000
p(target) 0.9967692
p(ruin) 0.0032308
avg trials 18591.5725316
[1] 900
[1] 650
> ror.3cp(250,1000)
[1] "3 card poker. Overshoot target possible"
data
stake 250.000000000
p(target) 0.996769199
p(ruin) 0.003230801
avg trials 21453.497953254
[1] 1000
[1] 750
>
Sally
that is interesting!Quote: Ace2RS,
Knowing the SD and EV of the game you solve for p and payout.
(p x (1-p))^.5 x payout = 1.75.
p x payout = 1.035.
As a verification
(.26 x .74) ^ .5 x 3.98 = 1.75 SD rounded.
.26 x 3.98 = 1.035 EV rounded.
So analyzing the long term behavior of this game (the net result after x plays will be EV +/- SD) is like looking at a game with p = .26 and payout 3.98 for 1.
Alan Krigman (when he was alive) posted an Excel sheet from I think a Peter Griffin book?
(the webpage is long gone and I can't find it in any archive)
about the concept of
'even-money equivalents'
my guess (from some reading) is so the Gambler's ruin formula could be used
so it shows for:
expectation: 0.034828622
variance: 3.033602622
converts too
Bet: 1.74207223
Prob of winning: 50.99963%
0.3201096% Ruin
using the GR formula
from the sheet
Bet = sqrt(variance+ev^2)
Prob of winning: 0.5+(0.5*ev) / Bet
still the wonder of math.
not always one path to take to find the correct result!
so cool
Sally
Alan Krigman's Excel sheet can be found in my online folder
link in my blog here
https://wizardofvegas.com/member/mustangsally/blog/#post1094
file: equiv_bets.xls
my Uncle added this as he has the webpage:
"Equation 1, alone, is of limited value because of the restriction to even-money bets.
Peter Griffin (The Theory of Blackjack, Extra Stuff: Gambling Ramblings), however, suggested that arbitrary bets can be reduced to even-money equivalents -- amounts and probabilities of winning -- with the same expectations and variances as the prototype wagers.
A method for calculating the even-money equivalents has been described by Alan Krigman (50-50 and Even-Money Equivalent Bets -- www.bjmath.com/bjmath/Betsize/equmb.htm). ***link no longer valid***
This shows that the even-money equivalent bet size and probability of winning can be found from Equations 2 and 3, respectively.
Calculate the even-money p and w from the edge and variance of the prototype bet using Equations 2 and 3, then substitute the results into Equation 1 to get risk of ruin."
Unfortunately this method is only consistently accurate for higher bankrolls. Generally over 100 or even higher for low edge games. Same issue for the risk of ruin formula.Quote: mustangsally
my Uncle added this as he has the webpage:
"Equation 1, alone, is of limited value because of the restriction to even-money bets.
Peter Griffin (The Theory of Blackjack, Extra Stuff: Gambling Ramblings), however, suggested that arbitrary bets can be reduced to even-money equivalents -- amounts and probabilities of winning -- with the same expectations and variances as the prototype wagers.
A method for calculating the even-money equivalents has been described by Alan Krigman (50-50 and Even-Money Equivalent Bets -- www.bjmath.com/bjmath/Betsize/equmb.htm). ***link no longer valid***
This shows that the even-money equivalent bet size and probability of winning can be found from Equations 2 and 3, respectively.
Calculate the even-money p and w from the edge and variance of the prototype bet using Equations 2 and 3, then substitute the results into Equation 1 to get risk of ruin."
And I think few of us go gambling with a bankroll of hundreds of units.
agree, when one wants or requires an estimate that is close, at least it is in the ballpark.Quote: Ace2Unfortunately this method is only consistently accurate for higher bankrolls.
of course with so many ways to get the exact result these days,
it seems like a waste of time just to estimate (being more expensive that is, in math lingo),
to me that is
as that requires more time than just a direct calculation.
but it is what it is
then again, can one really tell the difference between a RoR of 0.10 and 0.0975?
here is my final Markov chain data for turning 250 units into at least X
> ror.3cp(250,500)
[1] "3 card poker. Overshoot target possible"
data
stake 250.000000000
p(target) 0.996779348
p(ruin) 0.003220652
avg trials 7144.016356530
[1] "target: 500"
[1] "gain: 250"
> ror.3cp(250,600)
[1] "3 card poker. Overshoot target possible"
data
stake 250.000000000
p(target) 0.996770216
p(ruin) 0.003229784
avg trials 10005.813690248
[1] "target: 600"
[1] "gain: 350"
> ror.3cp(250,700)
[1] "3 card poker. Overshoot target possible"
data
stake 250.000000000
p(target) 0.996769301
p(ruin) 0.003230699
avg trials 12867.723664022
[1] "target: 700"
[1] "gain: 450"
> ror.3cp(250,800)
[1] "3 card poker. Overshoot target possible"
data
stake 250.000000000
p(target) 0.996769209
p(ruin) 0.003230791
avg trials 15729.647294715
[1] "target: 800"
[1] "gain: 550"
> ror.3cp(250,900)
[1] "3 card poker. Overshoot target possible"
data
stake 250.0000000
p(target) 0.9967692
p(ruin) 0.0032308
avg trials 18591.5725316
[1] "target: 900"
[1] "gain: 650"
> ror.3cp(250,1000)
[1] "3 card poker. Overshoot target possible"
data
stake 250.000000000
p(target) 0.996769199
p(ruin) 0.003230801
avg trials 21453.497953254
[1] "target: 1000"
[1] "gain: 750"
> ror.3cp(250,1500)
[1] "3 card poker. Overshoot target possible"
data
stake 250.000000000
p(target) 0.996769199
p(ruin) 0.003230801
avg trials 35763.125176275
[1] "target: 1500"
[1] "gain: 1250"
[1] "3 card poker. Overshoot target possible"
data
stake 250.000000000
p(target) 0.996769199
p(ruin) 0.003230801
avg trials 50072.752402225
[1] "target: 2000"
[1] "gain: 1750"
Sally
Quote: Ace2RS,
Knowing the SD and EV of the game you solve for p and payout.
(p x (1-p))^.5 x payout = 1.75.
p x payout = 1.035.
As a verification
(.26 x .74) ^ .5 x 3.98 = 1.75 SD rounded.
.26 x 3.98 = 1.035 EV rounded.
So analyzing the long term behavior of this game (the net result after x plays will be EV +/- SD) is like looking at a game with p = .26 and payout 3.98 for 1.
Thanks, that makes sense.
Just to verify, I get the following:
p = 0.25914278284
payout = 3.99394
Or for another game, let's say full pay deuces wild (found here: https://wizardofodds.com/games/video-poker/strategy/a-1-b-44-c-1-d-0-d-1-d-2-d-2-d-3-d-5-d-9-d-15-d-25-d-200-d-800/ ), you'd get:
p = 0.03780624821089504
payout = 26.6522082376
So full pay deuces wild is equivalent to a game where I have a 3.78% chance to win a payout of 26.65-for-1 (or 25.65-to-1)? Numbers rounded, of course.
The next thing I'm trying to do is to calculate the RoR considering that 25% of the time the player plays basic strategy agains the relief dealer (so in 1 hour he plays 45 minutes with a player's edge and 15 minutes with a house edge) with a betting unit 1/5 of his original $200 bet (so $40).
Is it wrong to calculate the average player's edge, adjusted for his original betting unit and derive the RoR from that?
What I mean is:
Considering 30 rounds/h, he plays 22.5 rounds with a 3.4829% edge and 7.5 rounds against a 3.3730% house edge.
But the 3.3730% house edge is betting 1/5 of $200
So to convert that to the impact the house edge has on his $200 betting unit is 0.033730/5=0.006746
To calculate the average edge relative to his $200 betting unit: [(0.034829*22.5)+(-0.006746*7.5)]/30=0.02443525
So his average edge also considering the time against the relief is 2.443525%
I believe to plug that into the formula we need to derive the average standard deviation?
[(3.033603*22.5)+(2.687150*7.5)]/30=2.94698975 (this is variance, not SD, but we can plug that into the formula directly)
RoR formula:
e^[(-2*0.02443525*250)/2.94698975]=0.01583079369
so 1.58% RoR?
Please tell me if this is right or if I'm way off.
Thank you
I get a combined advantage of 12.2 %. That’s on a base bet of $40 that gets raised to $200 3/4 of the time. I combined/weighted the 2 pay tables of the 2 scenarios.
Variance is 57.5.
So e ^ (2 x 1,250 x .122 / 57.5) = 0.49 % risk of ruin.
I ran this pretty quickly so I may have to correct later.
Quote: Ace2I assumed bankroll of $50,000 / $40 = 1,250.
I get a combined advantage of 12.2 %. That’s on a base bet of $40 that gets raised to $200 3/4 of the time. I combined/weighted the 2 pay tables of the 2 scenarios.
Variance is 57.5.
So e ^ (2 x 1,250 x .122 / 57.5) = 0.49 % risk of ruin.
I ran this pretty quickly so I may have to correct later.
Why would you go from $40 to $200 3/4 of the time hole carding 3 card?
Edit: nevermind. I see why he did.
But how did you come up with 57.5 variance?
Put the 2 tables together , 1 above the other. Multiply the payouts/losses by 5 for the player advantage table. Weight the two at 25%/75%. Square all the differences (payout vs 12.2 %) for each weighted line and then sum them all.Quote: gunbjI understand the 12.2% advantage relative to the $40 bet, which in my case was the other way around (relative to the $200 bet it's 2.44%).
But how did you come up with 57.5 variance?
You used an “average standard deviation” for 2 separate bets, and I don’t think that’s ever valid.Quote: gunbjI was able to get your results, I guess my mistake was not to size the variance to the betting unit.
Quote: Ace2You used an “average standard deviation” for 2 separate bets, and I don’t think that’s ever valid.
That's true
Correction: Just to clarify I actually do get the same result by making an average of the variance, it's just that it has to be sized to the bets through the payouts. Once it's sized you can weight it and sum or just find the average, it's the same.
I mean if a player played or folded anything lower than, say, a pair of Aces randomly, sometimes playing weak hands in the hope that the dealer will not qualify, sometimes folding K high hands "feeling" the dealer has a higher hand, both with 50% chance, which is the behaviour we can assume from a gambler (or a mistake)?
I know the Wizard said in his 3CP analysis that playing "blind" (playing everything, never folding) results in a house edge of 7.65%, and Grosjean writes numbers like 8.3% or 9.47% for example if you follow the plays of a player who you think has information about the dealer's cards but actually doesn't.
Any ideas?