Open Side Menu Go to the Top
Register
Standard Deviation - How does a live player calculate this? Standard Deviation - How does a live player calculate this?

09-02-2009 , 05:35 PM
Starting this year, I have been keeping records about each session played at LIVE casinos. One of the values I have been capturing are net results (eg. +$400, -$200, etc). Along with the net result, I have been capturing session time (in hours).

Here is an example of the records:
Session 1: $100 6 hours
Session 2: -$200 4 hours
Session 3: +$500 5 hours
Session 4: -$100 5 hours

I have all of this in an excel spreadsheet and I use that to calculate win rate (expressed in $/hour), net winnings, and graph my results.

I have done extensive searching about how to calculate the standard deviation. If I use the built in excel formula stdev
on the net results, then the duration is not taken into to consideration. Basically, I want to get the standard deviation in units of $/hr. Nearly everything I find about standard deviation as it relates to poker references PokerTracker and the details tab, but I don't use PokerTracker for live poker.

How can I calculate my standard deviation (in $/hr) based on a log of net results and durations like the above table for example?

I can then use excel to do the math and then take my standard deviation and make calculations on my bank roll requirements and variance.

Much thanks!
Standard Deviation - How does a live player calculate this? Quote
09-02-2009 , 09:16 PM
Here is one way. Get the standard deviation per hour for each data point. Then use a weighted formula where the weights are the number of hours played.

For example
Win amount Number of hours Win Rate/Hr
120 .....................6 .................... 20
50 .......................2 .................. 25

You have here the equivalent of 8 observations, 6 with a win rate of 20 and 2 with a win rate of 25. Suppose the data were in Columns A, B and C of Excel. The formula for the weighted standard deviation is

=SQRT(SUMPRODUCT((C1:C2-C3)^2,B1:B2)/(SUM(B1:B2)-1))

where C3 = SUMPRODUCT(C1:C2,B1:B2)/SUM(B1:B2), the weighted average.
For this example, the answer is 2.31455.
Standard Deviation - How does a live player calculate this? Quote
09-04-2009 , 04:00 AM
Convert each session into $/hr: { +16.66, -50, +100, -20 } , then take the s.d. of that set.
Standard Deviation - How does a live player calculate this? Quote
09-04-2009 , 06:17 PM
Quote:
Originally Posted by statmanhal
Here is one way. Get the standard deviation per hour for each data point. Then use a weighted formula where the weights are the number of hours played.

For example
Win amount Number of hours Win Rate/Hr
120 .....................6 .................... 20
50 .......................2 .................. 25

You have here the equivalent of 8 observations, 6 with a win rate of 20 and 2 with a win rate of 25. Suppose the data were in Columns A, B and C of Excel. The formula for the weighted standard deviation is

=SQRT(SUMPRODUCT((C1:C2-C3)^2,B1:B2)/(SUM(B1:B2)-1))

where C3 = SUMPRODUCT(C1:C2,B1:B2)/SUM(B1:B2), the weighted average.
For this example, the answer is 2.31455.
This is not the proper way to compute standard deviation for sessions of varying duration, and this cannot be done with the standard deviation formula from Excel. The correct formula which gives the maximum-likelihood estimate of the variance σ2 is:





where
Xi is the amount won in the ith session (dollars or bb)
Ti is the duration of the ith session (hours or hands)
µ is the win rate per unit time ($/hr, bb/hand, etc.)
N is the number of sessions
SD is standard deviation

I've included a derivation of this formula below which is essentially the same derivation that appears in the appendix of Mason's Gambling Theory and Other Topics.

Note that the number of terms is equal to the number of sessions played which is the N that we divide by out front, and each term is divided by the duration of each session. The expected result of each session, which is subtracted in each term, is the hourly rate times the duration of the session. Note that the win rate µ is computed over all sessions, not for each session.

Note that by your method, if a player has a session 5 hours long in which he wins $500, you would enter this as 5 hours in which he won $100 each hour. This will give a different result as it implies a greater consistency than we can actually assume.

I can provide an Excel spreadsheet which performs this calculation correctly to anyone interested.

---------

This is the derivation of the maximum likelihood estimator for the variance for sessions of variable length. The derivation is exactly the same as the textbook derivation for sessions of equal length, except that the variance is multiplied by the session length Ti, and the standard deviation is multiplied by . Here is the derivation:

Let X be a vector of session results, and Ti be the duration of the ith session. Each session result Xi is a random variable distributed as a normal distribution of mean Ui = µTi, and unknown variance Tiσ2, where µ and σ2 are the mean and variance for 1 unit of time or number of hands (e.g. 100 hands). The probability distribution of a given observation Xi given σ is:



This is simply the definition of the normal distribution where the standard deviation has been replaced by , and the variance has been replaced by Tiσ2. The conditional probability of a vector of N observations X given σ, called the likelihood function, is obtained by multiplying N of these together, which causes a sum to appear in the exponential, and a product of out front.



To find the value of σ2 which maximizes the likelihood function, it is convenient to take the log of the likelihood function and maximize that. The logs of products become sums.



Taking the derivative of this with respect to σ2 and setting = 0:





Note the similarity of this result to the standard definition of variance for sessions of equal duration. The only differences are that each term inside the sum is divided by the session duration Ti, and the constant mean µ has been replaced with Ui which depends on the duration of each session. If the sessions are of equal length, Ti becomes a constant T which can be removed from the sum, and the sum would be divided by NT which is the total number of hours in N sessions.

To put this in the form found in Mason’s essay, expand the square, and break this into 3 sums:



Since Ui = µTi,



Now since is the sum of the session results, this is the same as the hourly rate µ times the total hours, or , so the second term is . This can be combined with the final term to give Mason’s form:



Caution: This form may be highly susceptible to round off error.

Last edited by BruceZ; 02-13-2010 at 03:00 AM.
Standard Deviation - How does a live player calculate this? Quote
09-05-2009 , 05:54 PM
I decided to use my above post to teach myself LaTex, the tool that allows formating mathematical equations. So if you tried to read it in its original ASCII version and gave up, you might want to try again now that it is much more readable. This is the formula for computing your standard deviation for sessions of varying duration, along with the derivation of this formula which is the maximum likelihood estimator.
Standard Deviation - How does a live player calculate this? Quote
09-06-2009 , 02:05 AM
Quote:
Originally Posted by BruceZ
I decided to use my above post to teach myself LaTex, the tool that allows formating mathematical equations.
Nice!

You know what would be awesome, for a few forums like this one, poker theory, etc, is if you could do something like

[tex]
MARKUP HERE
[/tex]

and it sent it through the latex parser and replaced it with the results - sort of like how the built in HH converter works. Whether or not it should use full latex I don't know - you don't really need the full power of latex with it's \begin{document} and all that, you really just want (for the most part) what you get in the equation environment. So maybe what we need is just

[equation]
[/equation]

for standalone equations, and something similar but different for inline ones (like $my equation here$ in latex)

I used to be a huge latex dork when I was in school, have hardly touched it since. Good stuff though. It used to torture me to watch fellow students struggle with microsoft's equation editor.
Standard Deviation - How does a live player calculate this? Quote
09-06-2009 , 02:42 AM
Quote:
Originally Posted by RustyBrooks
Nice!

You know what would be awesome, for a few forums like this one, poker theory, etc, is if you could do something like

[tex]
MARKUP HERE
[/tex]

and it sent it through the latex parser and replaced it with the results - sort of like how the built in HH converter works. Whether or not it should use full latex I don't know - you don't really need the full power of latex with it's \begin{document} and all that, you really just want (for the most part) what you get in the equation environment. So maybe what we need is just

[equation]
[/equation]

for standalone equations, and something similar but different for inline ones (like $my equation here$ in latex)

I used to be a huge latex dork when I was in school, have hardly touched it since. Good stuff though. It used to torture me to watch fellow students struggle with microsoft's equation editor.
It's almost that simple now. Do you understand that I am calling the Latex parser directly from this text box with

[IMG]http://latex.codecogs.com/gif.latex?
EQUATION HERE
[/IMG]

For inline equations I am currently doing the same thing except adding \textstyle before the equation to reduce the size of the equation to match the text.

There are no intermediate files produced. Jason1990 has a sticky post about this on the Science, Math, Philosophy forum.

Last edited by BruceZ; 09-07-2009 at 01:04 PM.
Standard Deviation - How does a live player calculate this? Quote
09-07-2009 , 12:49 PM
Hah, wow no I didn't realize that. That's pretty sweet. I am gonna use the hell out of that, thanks!
Standard Deviation - How does a live player calculate this? Quote
10-13-2009 , 01:39 PM
BruceZ,

Can you pease send me the formula you use in excell to determine standard deviation per hour when the spreadsheet has number of hours played/session and amount won or lost/session. You can e-mail me at david.w.harless@gmail.com
Standard Deviation - How does a live player calculate this? Quote
04-02-2012 , 09:23 PM
Bump to avoid possible future archiving.
Standard Deviation - How does a live player calculate this? Quote
04-03-2012 , 09:31 AM
Quote:
Originally Posted by tringlomane
Bump to avoid possible future archiving.
That's no longer happening
Standard Deviation - How does a live player calculate this? Quote
04-03-2012 , 03:04 PM
Oops, missed the memo then. Thanks.
Standard Deviation - How does a live player calculate this? Quote
04-09-2012 , 08:53 PM
If someone industrious wants to add it, I think a proof of consistency as would be more convincing to people and a bit more transparent than just showing that the estimator is ML for normally distributed segments (which may or may not be a reasonable approximation depending on the length of the sessions, but I think the estimator works regardless so long as holds).
Standard Deviation - How does a live player calculate this? Quote
01-16-2021 , 01:22 AM
Quote:
Originally Posted by BruceZ
This is not the proper way to compute standard deviation for sessions of varying duration, and this cannot be done with the standard deviation formula from Excel. The correct formula which gives the maximum-likelihood estimate of the variance σ2 is:





where
Xi is the amount won in the ith session (dollars or bb)
Ti is the duration of the ith session (hours or hands)
µ is the win rate per unit time ($/hr, bb/hand, etc.)
N is the number of sessions
SD is standard deviation

I've included a derivation of this formula below which is essentially the same derivation that appears in the appendix of Mason's Gambling Theory and Other Topics.

Note that the number of terms is equal to the number of sessions played which is the N that we divide by out front, and each term is divided by the duration of each session. The expected result of each session, which is subtracted in each term, is the hourly rate times the duration of the session. Note that the win rate µ is computed over all sessions, not for each session.

Note that by your method, if a player has a session 5 hours long in which he wins $500, you would enter this as 5 hours in which he won $100 each hour. This will give a different result as it implies a greater consistency than we can actually assume.

I can provide an Excel spreadsheet which performs this calculation correctly to anyone interested.

---------

This is the derivation of the maximum likelihood estimator for the variance for sessions of variable length. The derivation is exactly the same as the textbook derivation for sessions of equal length, except that the variance is multiplied by the session length Ti, and the standard deviation is multiplied by . Here is the derivation:

Let X be a vector of session results, and Ti be the duration of the ith session. Each session result Xi is a random variable distributed as a normal distribution of mean Ui = µTi, and unknown variance Tiσ2, where µ and σ2 are the mean and variance for 1 unit of time or number of hands (e.g. 100 hands). The probability distribution of a given observation Xi given σ is:



This is simply the definition of the normal distribution where the standard deviation has been replaced by , and the variance has been replaced by Tiσ2. The conditional probability of a vector of N observations X given σ, called the likelihood function, is obtained by multiplying N of these together, which causes a sum to appear in the exponential, and a product of out front.



To find the value of σ2 which maximizes the likelihood function, it is convenient to take the log of the likelihood function and maximize that. The logs of products become sums.



Taking the derivative of this with respect to σ2 and setting = 0:





Note the similarity of this result to the standard definition of variance for sessions of equal duration. The only differences are that each term inside the sum is divided by the session duration Ti, and the constant mean µ has been replaced with Ui which depends on the duration of each session. If the sessions are of equal length, Ti becomes a constant T which can be removed from the sum, and the sum would be divided by NT which is the total number of hours in N sessions.

To put this in the form found in Mason’s essay, expand the square, and break this into 3 sums:



Since Ui = µTi,



Now since is the sum of the session results, this is the same as the hourly rate µ times the total hours, or , so the second term is . This can be combined with the final term to give Mason’s form:



Caution: This form may be highly susceptible to round off error.
Hey BruceZ,
This is very helpful. I am struggling to input the formula into excel. When I highlight my data range (one column for duration, one column for profit/loss) when I go to highlight one of these columns I think excel thinks I am asking it to add the whole column when instead I want excel to know that the two columns are correlated. (X1 goes with T1, X2 goes with T2, etc...).

Any help with the excel formula would be very helpful. I'm starting to pull my hair out here.

Thank you for the great post. I have looked everywhere online for this, and your post is the only resource I have been able to find.
Standard Deviation - How does a live player calculate this? Quote
01-16-2021 , 04:20 AM
I figured this out. I ran the formula through each row and then summed the total row.
Lol just like Stats homework.
Standard Deviation - How does a live player calculate this? Quote
01-18-2021 , 02:56 AM
I thought this was a new thread and I was literally about to come in a post a link to this. I think I have it bookmarked, hah.

There actually is a way to calculate the entire thing without intermediate calculations for each row. You can do it in one cell. Google array formulas.

I have session results in column A, and session length in column B. This is the formula I use to calculate standard deviation. The E311 term is win-rate, which I calculate in column E:

=SQRT(1/COUNT(A2:A311)*SUM((A2:A311-E311*B2:B311)^2/B2:B311))

When you are finished typing the formula, hold ctrl+shift and press enter. If it worked it should add brackets around the formula to indicate it's an array formula. For some reason it only works on a cell you just edited. Trying to convert an already finished formula to an array formula won't work unless you edit it first. You can't just click the cell and ctrl+shift+enter.
Standard Deviation - How does a live player calculate this? Quote
01-31-2021 , 06:48 PM
Quote:
Originally Posted by browni3141
I thought this was a new thread and I was literally about to come in a post a link to this. I think I have it bookmarked, hah.

There actually is a way to calculate the entire thing without intermediate calculations for each row. You can do it in one cell. Google array formulas.

I have session results in column A, and session length in column B. This is the formula I use to calculate standard deviation. The E311 term is win-rate, which I calculate in column E:

=SQRT(1/COUNT(A2:A311)*SUM((A2:A311-E311*B2:B311)^2/B2:B311))

When you are finished typing the formula, hold ctrl+shift and press enter. If it worked it should add brackets around the formula to indicate it's an array formula. For some reason it only works on a cell you just edited. Trying to convert an already finished formula to an array formula won't work unless you edit it first. You can't just click the cell and ctrl+shift+enter.
Thank you for getting back to me. Unfortunately I get a very different result using the above formula than when I do the calculations with intermediate steps. As you stated I will learn more about array functions. However, for right now, this is the only way I know how to tell excel NOT to sum the total columns, and THEN make the calculations. But instead what we need is to perform the calculations in EACH row, and then sum the totals of this calculation across all of the data.

Thank you for the advice though.

This post is so helpful that it is helping people 11 years after. I hope BruceZ recognizes that his contribution to the community is greatly appreciated.

The other issue I am having is, in BruceZ's post about a likelihood estimator I am unable to view his formulas.

I found this site that uses BruceZ's formula and does the calculation for you,
http://www.reviewpokerrooms.com/poke...uirements.html

However, the inner geek in me is not satisfied. As I would like to learn how to input this formula myself so I am not dependant on a website.

Any help in this will be appreciated. If not, I shall work on figuring it out, using the website to check my answers to make sure my formula is correct. Once I figure it out, and if no one else has posted about this, I will update you all.

However, I do believe academic integrity is paramount. So if I am able to figure it out and share it with you all, I will make it a priority to credit BruceZ, as this is his work.

On another note, if anyone wants to make a standard deviation graph for their live play. There is a normal distribution function in excel (I am using numbers for mac) you can use. You will have to input the data for win rates per session though for the graph. But you will use the correct formula for standard deviation, and win rate over all sessions. I can post the steps for this if anyone is interested. Also if there are mistakes, I am always open to make corrections and learn.
I am considering making a youtube video, showing all the formulas, and graphs I am using for tracking my live sessions. I refuse to use live poker tracking apps, as I like to be able to be in control of my data, and be able to view it without being dependant on the app's software. If your goal is to make poker is your job, or you are simply just committed to improving your live game. You need this data, and you need to feel secure in where it is stored and where you can view it, long term. Just my two cents.
Standard Deviation - How does a live player calculate this? Quote
02-01-2021 , 12:39 PM
I found this site that uses BruceZ's formula and does the calculation for you,
http://www.reviewpokerrooms.com/poke...uirements.html

However, the inner geek in me is not satisfied. As I would like to learn how to input this formula myself so I am not dependant on a website.


A risk of ruin formula is

RoR = exp(-2BW/V)

where

B is your bankroll

W is your win rate

V is the variance

Then

B = -V*ln(RoR)/2W
Standard Deviation - How does a live player calculate this? Quote
10-27-2022 , 09:11 PM
Okay, I am a slow learner, and videos are best for me. If you are like me... here you go.

Special thank you to BruceZ.

Also, I used MacOS numbers so there is a limitation on array functions. I like numbers for personal reasons, however I also think it is a better teaching tool to see each step. If you are an advanced user, the array formula has already been posted.

What is Std Dev in Poker?
https://youtu.be/pYLsG4klX58


How to Calculate Std Dev in Live Poker (BruceZ's Formula)
https://youtu.be/79gkF-noYLo

How big should your bankroll be?
https://youtu.be/8XQP9VbW-lg

Let me know if you guys want another video showing how to make the graph?

The videos are not listed, so you need these links to access them, share them if you wish. Any issues opening let me know.
Standard Deviation - How does a live player calculate this? Quote

      
m