Open Side Menu Go to the Top
Register
Modelling poker variance Modelling poker variance

11-19-2020 , 05:32 AM
Hi!

I would like to make my own poker variance calculator to get a better grasp of the variance we subject ourselves to when playing poker (NLHE in particular).

I think a Brownian Motion with drift would be a good start, but I'm not sure. Any ideas/feedback is appreciated!
Modelling poker variance Quote
11-19-2020 , 11:12 AM
This ancient BruceZ post is probably a good starting point:
https://web.archive.org/web/20200814...5&o=14&fpart=2
Modelling poker variance Quote
11-19-2020 , 12:10 PM
Thank you very much!

So if I'm getting this right, to model the variance over the long-run we don't have to acquire some complex function that models the outcome of each hand. What we can do instead is approximate the distribution of each hand with our winrate and std. deviation by using them as parameters for a normal distribution (The coin flip).

After we have done that we can flip the same number of coins as hands as we wish to play (or have played) and simulate a random walk. We can simulate multiple random walks to get more outcomes.

Let me know if I'm on the right track.
Modelling poker variance Quote
11-20-2020 , 07:23 AM
Alright I tried to code something in R which is super simple, but actually seems to be doing alright (I'm actually a bit of an R noob):

Code:
n = 10000
m = n-1
x = rnorm(n, 0.05, 10)
x[1] = 0
y = rep(1, n)

y[1] = x[1]
for (i in 1:m)
{
  y[i+1] = y[i] + x[i+1]
}

plot(y, type="l")
The plot this produced seems to be a little more swingy than what this poker variance calculator produces, but it might be alright. What do you think?


Ideally I want more samples in the same graph, is using the multivariate normal distribution a good way to do this?
Modelling poker variance Quote
11-20-2020 , 01:00 PM
Quote:
Originally Posted by Im Nacho Friend
Ideally I want more samples in the same graph, is using the multivariate normal distribution a good way to do this?
Since you want your samples to be independent your co-variance matrix would just be a scaler multiple of the identity matrix, so there's not much point unless it makes coding it easier in R?

You might find this wiki page interesting: https://en.wikipedia.org/wiki/Wiener_process

Juk
Modelling poker variance Quote
11-20-2020 , 02:45 PM
I want multiple samples in a single graph so it’s purely for convenience. I realize now I can just put multiple normal distribution sims in a matrix and go from there.

I’m following the course “Markov Processes” at uni right now. That’s where the Bownian Motion came up and where I got the idea. I’m still not sure how to program that, but this seems to do the job for poker.
Modelling poker variance Quote
11-20-2020 , 07:33 PM
Quote:
Originally Posted by Im Nacho Friend
So if I'm getting this right, to model the variance over the long-run we don't have to acquire some complex function that models the outcome of each hand.
Right, technically each individual hand is a Categorical distribution with many parameters. In any given hand there are dozens/hundreds of different dollar amounts you might win or lose, each with a different probability. However, nobody can know their distribution on that microscopic of a level or anything close to it. Furthermore, the parameters change from session to session and even during a session.

Quote:
What we can do instead is approximate the distribution of each hand with our winrate and std. deviation by using them as parameters for a normal distribution (The coin flip).
You're half right. We model it as a coinflip, but that's a Bernoulli distribution (the single-variable version of Categorical). A large batch of N coinflips is what resembles a Normal distribution (though is technically Binomial), not the individual coinflips.

Two nice things about this: we get to eliminate hundreds of parameters, and we get to figure out the values of the few that remain.

Quote:
After we have done that we can flip the same number of coins as hands as we wish to play (or have played) and simulate a random walk.
I haven't played around with this, but I doubt this simplified walk will greatly resemble a true plot of poker hands at the zoomed-in level. Perhaps when zoomed out. This Bernoulli model is mainly for predicting RoR, which is about the destination rather than the exact path taken.

Is your goal to generate a plot that's visually indistinguishable from a real poker graph zoomed in?
Modelling poker variance Quote
11-21-2020 , 06:29 AM
Quote:
Originally Posted by heehaww
Right, technically each individual hand is a Categorical distribution with many parameters. In any given hand there are dozens/hundreds of different dollar amounts you might win or lose, each with a different probability. However, nobody can know their distribution on that microscopic of a level or anything close to it. Furthermore, the parameters change from session to session and even during a session.

...

Is your goal to generate a plot that's visually indistinguishable from a real poker graph zoomed in?
Thanks for clearing that up for me heehaww!

I'm a bit puzzled by the paper in Bruce's post, I don't really understand what exactly they're doing there. I also don't really understand how I should choose the parameters of a Bernoulli distribution to represent my winrate and standard deviation.

I don't need a graph that represents a poker results graph as closely as possible. I think that requires a lot more than winrate and std. dev and would be very complicated as we fold pre about 75% of the time for example. I would just like to get an idea of the stochastic process involved in the "variance" part of poker.
Modelling poker variance Quote
11-21-2020 , 01:20 PM
There may be specific terminology for this, but I would call the process a one-dimensional random walk whose step size varies according to a Categorical distribution.* Perhaps this is simply called a Categorical random walk, like how when the step size is pulled from a Gaussian distribution that's called a Gaussian random walk. (*Or maybe formally this would be split into two Categorical distributions? Ie, a probability p of taking a positive step drawn from one distribution, and probability 1-p of a negative step drawn from the other, where p is the sum of the probabilities from the first distribution. Either way it's the same idea.)

Since you're taking a course on Markov Processes (good choice!), I should also mention that this is a Markov chain.

Quote:
I'm a bit puzzled by the paper in Bruce's post, I don't really understand what exactly they're doing there. I also don't really understand how I should choose the parameters of a Bernoulli distribution to represent my winrate and standard deviation.
The Ethier/Khoshnevisan paper? I think Bruce's English explanation is sufficient if one doesn't need full proof. Feller vol 1 is referenced in their paper and that's a book worth owning.

The goal there was to estimate the chance of going broke with a given bankroll, WR and SD. Ideally we'd know our exact monstrous distribution, but even if we did, we'd need computer brute force to figure out our ruin % because we couldn't derive a usable formula from that distribution. By contrast, the ruin probability concerning a series of coinflips (with a single payout) is much simpler, allowing for a friendly formula (Bruce's Eq 1). So by modeling each hand as a coinflip (instead of a 300-sided die roll with 300 different payouts), we'd be able to use the coinflip ruin formula.

Each coinflip, the gambler bets the same amount b and has the same probability p of winning. To make this analogous to a poker hand, we choose the p and b that would cause the coinflip EV to match our WR and the coinflip variance to match our observed variance. These turn out to be:

b = √(WR² + SD²)
p = ½ + WR/[2√(WR² + SD²)]

Then we can substitute those into Eq 1 which was r = (q/p)^B/b. If it's the bankroll B you're trying to solve for, continue on with the derivation of a simpler exponential formula, but if you only care about r, that's optional.

That's not 100% exact (even if the WR and SD are) since it's a vast simplification of the true underlying process (the many-sided die or Many-Faced Poker God), but accurate within fairly tight bounds established in the Ethier/K paper.
Modelling poker variance Quote
11-22-2020 , 06:33 PM
Quote:
Originally Posted by heehaww
There may be specific terminology for this, but I would call the process a one-dimensional random walk whose step size varies according to a Categorical distribution.
...

That's not 100% exact (even if the WR and SD are) since it's a vast simplification of the true underlying process (the many-sided die or Many-Faced Poker God), but accurate within fairly tight bounds established in the Ethier/K paper.
Tyvm again!

Quote:
The Ethier/Khoshnevisan paper?
Yes that one.

Quote:
b = √(WR² + SD²)
p = ½ + WR/[2√(WR² + SD²)]
This is ultimately what I was looking for so thank you!
Bruce's post is more clear to me now. The derivation for these is shown in Sileo's paper and is the same for poker and blackjack?

I'm also wondering if we would ever be able to test how far our simulations would differ from actual variance simulations (so if we were to use a very complicated categorical distribution)?
Modelling poker variance Quote
11-23-2020 , 06:22 AM
Alright so this is what I have now:

Code:
n = 100000
N = 5
wr = 0.05
sd = 10
m = n-1

b = sqrt(wr^2 + sd^2)
p = 0.5 + wr/(2*b)
x = matrix(0, nrow = N, ncol = n)

for (i in 1:N)
{
  x[i,] = b*(rbinom(n, 1, p))
}
z = replace(x, x==0, -b)
y = matrix(0, nrow = N, ncol = n)

for(j in 1:N)
{
for (i in 1:m)
{
  y[j, i+1] = y[j, i] + z[j, i+1]
}
}

nums = seq(0, m, 1)
zero = rep(0, n)
EV = wr*nums
zeroEV = rbind(EV, zero)
all = rbind(y, zeroEV)

matplot(t(all), type="l")
Which gives me the following:


Thanks for all the help heehaww!

I find this a nice way to think about variance:
"All we can do is to try to play each individual hand as well as we can. The stochastic process will take care of the rest."
Modelling poker variance Quote
11-23-2020 , 07:50 PM
Quote:
Originally Posted by Im Nacho Friend
The derivation for these is shown in Sileo's paper and is the same for poker and blackjack?
Right, the takeaway is that the effect of the higher moments vanishes over time while the first two moments (mean & variance) dominate. Therefore the skewness, kurtosis and in general the "fine structure of the game" (as Bruce put it) can be ignored when N is large enough.

Quote:
I'm also wondering if we would ever be able to test how far our simulations would differ from actual variance simulations (so if we were to use a very complicated categorical distribution)?
I did a quick test for a hypothetical game with 7 possible outcomes per wager:

win 12 = 20%
win 10 = 20%
lose 8 = 15%
lose 4 = 15%
lose 7 = 10%
lose 5 = 10%
lose 3 = 10%

If our bankroll is B and we can't move down in stakes, then by brute force the exact ruin probability r(B) is:
r(60) = 0.1538604
r(100) = 0.0398376
r(150) = 0.0073578
P(get above 99 starting from 50) = 0.8125958

Compare those to our approximations, using our EV per bet of +1.10 and variance of 67.89:
r(60) = 0.1463808
r(100) = 0.0406575
r(150) = 0.0081980
P(get above 99 starting from 50) = 0.7983631

This lends some confirmation to the approximation being an accurate one. Some distributions will fit the model better than others, but even a "nemesis" distribution will fit the bounds shown in Ethier/K, which are tight IIRC.
Modelling poker variance Quote
11-24-2020 , 06:52 AM
Oh yeah that's a nice example fo a game that shows that the approximations are reasonably accurate.

Maybe a good way to model variance for short term periods is to go by position. Then we can maybe model some sort of categorical distribution. For example OTB we win 0BB 60% of the time when we fold, we steal the blinds x% of the time and win 1.5BB, get a cbet through y% of the time etc.

One might be able to construct something like this with an enormous database. Would be cool to see.

Anyway this model serves its purpose so thank you for the help again!
Modelling poker variance Quote
12-07-2020 , 10:15 AM
I should add that if one is only interested in the chance of a certain profit/loss after N hands, without regard for ruin occurring before they're done, then the coinflip model is still accurate (as in plugging the pretend coin probability into the Binomial distribution), but less so than simply plugging the winrate and stddev into the Normal distribution. If the single-hand standard deviation is σ, then for N hands it's σ√N. The mean of N hands is of course N*(per-hand winrate).
Modelling poker variance Quote

      
m