PDA

View Full Version : Variance calculation error in [i]Gambling Theory[/i]?

nxmndr
11-24-2004, 07:05 PM
I was reading Gambling Theory and Other Topics by Malmuth and there's an equation on p. 62 (attributed to Mark Weitzman) where it gives a formula for calculating the variance (and thus standard deviation) of the win rate from a hand history. The calculation it gives is (please forgive the ASCII equations throughout):

sigma^2 = (1/N) sum (X_i^2/T_i) - (U^2/N) sum T_i

where

sigma^2 is the variance
N is the total number of trials
X_i is the win of the ith trial
T_i is the duration of the ith trial
U is the average win rate for all trials; U = sum X_i/sum T_i

(All sums are from 1 to N.)

I just did the calculation and it occurs to me that this formula is in error. For starters, it should be clear that this equation has the wrong units! The variance given has units of dollars squared per hour (N is dimensionless, X_i is dollars, T_i is hours, and U is dollars per hour). The standard deviation, thus, would be the square root of this, which is not a reasonable physical quantity (it would be dollars per hour^(1/2)!).

The official definition of variance with respect to an arbitrary trial a_i with probability p_i and a mean mu is

sigma^2 = sum (a_i - mu)^2 p_i

We're interested in the win/loss _rate_, not the win, so using the above figures this would be:

sigma^2 = sum (X_i/T_i - U)^2 (T_i/sum T_i)

Simplifying this out, we get

sigma^2 = (1/T) [sum X_i^2/T_i - X^2/T],

where X = sum X_i and T = sum T_i (that is, the total win for all trials, and the total time taken by all trials, respectively).

I can reproduce the equation given in the book if you start with the variance formula written as (note: wrong):

sigma^2 = sum (X_i/T_i - U)^2 (T_i/N)

that is, treating the probability of each trial p_i = T_i/N. This isn't correct, since probability should be dimensionless.

Now the figure calculated from the equation given in the book will be correlated with the variance/standard deviation in the win/loss rate if each T_i is small compared to T (that is to say, if the differences between each T_i are not significant compared to T). But the square root of the figure it calculates is not the standard deviation in dollars per hour.

BruceZ
11-27-2004, 11:46 AM
[ QUOTE ]
I was reading Gambling Theory and Other Topics by Malmuth and there's an equation on p. 62 (attributed to Mark Weitzman) where it gives a formula for calculating the variance (and thus standard deviation) of the win rate from a hand history. The calculation it gives is (please forgive the ASCII equations throughout):

sigma^2 = (1/N) sum (X_i^2/T_i) - (U^2/N) sum T_i

where

sigma^2 is the variance
N is the total number of trials
X_i is the win of the ith trial
T_i is the duration of the ith trial
U is the average win rate for all trials; U = sum X_i/sum T_i

(All sums are from 1 to N.)

I just did the calculation and it occurs to me that this formula is in error. For starters, it should be clear that this equation has the wrong units! The variance given has units of dollars squared per hour (N is dimensionless, X_i is dollars, T_i is hours, and U is dollars per hour). The standard deviation, thus, would be the square root of this, which is not a reasonable physical quantity (it would be dollars per hour^(1/2)!).

[/ QUOTE ]

There is no error in this formula, and the units are correct. The formula is the maximum likelihood estimator of the variance for sessions of variable duration. This means that it gives the value of sigma which is most likely to result in the observed data, assuming that the data is normally distributed. Note that this is NOT the same as the most likely value of sigma given the data. It is the likelihood of the data that is being maximized, not the likelihood of sigma.

We are assuming each session result Xi is a random variable distributed as a normal distribution of mean Ui = uTi, and unknown variance Ti*sigma^2 . This assumption of normality is validated for some sufficiently long Ti as guaranteed by the central limit theorem, though the required length is data dependent and a subject of debate. The probability distribution of a given observation Xi given sigma is:

f(Xi | sigma) = 1/[ sqrt(2*pi*Ti)*sigma ]*exp[ -(Xi - Ui)^2/(2*Ti*sigma^2) ]

This is simply the definition of the normal distribution where the standard deviation has been replaced by sqrt(Ti)*sigma, and the variance has been replaced by Ti*sigma^2. The conditional probability of a vector of N observations X given sigma, 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 1/sqrt(Ti) out front.

f(x | sigma) = [ (2*pi*sigma^2)^-N/2 ]*prod[i=1 to N][1/sqrt(Ti)]*exp[ -1/(2*sigma^2) ]*sum[i = 1 to N](Xi - Ui)^2/Ti

This is maximized by differentiating with respect to sigma^2, setting the result to zero, and solving for sigma^2 to yield Mason's formula. Actually the log is taken before differentiating to facilitate the algebra. The entire derivation can be found in the back of Gambling Theory and Other Topics. I derived this formula independently a while back in order to verify it before I realized that the derivation was in GTAOT. The derivation parallels the classical derivation of the maximum likelihood estimator for fixed length sessions found in many statistics texts, except that sigma^2 is replaced by Ti*sigma^2, and and sigma is replaced by sqrt(Ti)*sigma.

[ QUOTE ]
We're interested in the win/loss _rate_, not the win

[/ QUOTE ]

Actually, Ti*sigma^2 is the variance of the win after Ti hours, and so sigma^2 has units of dollars^2/hour, and the units of sigma are dollars/hour^0.5. This is the standard deviation that poker players often quote incorrectly as, for example, "10 bb/hr". What they really mean is that their sigma is 10 bb/hr^.5.

It sounds like you are interested in the standard deviation of the win rate. This is called the standard error (SE), and it is obtained by dividing sigma^2 by the number of hours played, and then taking the square root, so SE = sigma/sqrt(hours played), and has units of bb/hr.