2
$\begingroup$

Context

So I'm doing some research regarding the Kelly Criterion. By considering a coin tossing game in which you have even money odds where there is a probability $p > 1/2$ of winning, a probability $q < 1/2$ of losing and you bet the fraction $\ell$ of your capital in each bet. Then, your capital at time $k$ will be $W_k = W_0(1 + \ell)^S(1-\ell)^F$, where $W_0$ is the initial capital and $S$ is the number of successes and $F$ the number of failures. From what I understand this means that, \begin{align} \frac{W_k}{W_0} = \exp\{Bk\}, \quad \text{where: } B = \frac{1}{k}\log\left(\frac{W_k}{W_0}\right). \end{align}

The expected value of the random variable which dictates the rate of growth of our capital will be $E[B] = p \log(1 + \ell) + q \log(1 - \ell)$, which is maxed by taking $\ell^* = p -q$.

In practice

I tried running a simulation in R to show that by playing a large number of games, the gamblers capital indeed increase by an exponential rate of $p \log(1 + \ell) + q \log(1 - \ell)$ per trial, however my results show that the capital increases by double the expected rate. For example, taking $p = .55$, $k = 20$ and by performing a million simulations I get that the growth rate per trial $B = 0.0099834$. However, the expected value of $B$ under the context stated equals: \begin{align} E[B] = .55\log(1+.1) +.45\log(1-.1) = 0.005008367 \end{align} which is approximately half of what I observe in my simulation.

So the question is: why is this happening?

Code

#Function which computes the wealth process under a Kelly strategy
kelly <- function(odds, p, k, w_0){
#coin toss
  l_optima <<- (p*odds - (1-p))/odds
  toss <<-  sample(c(1 + odds*l_optima,1 - l_optima), k, replace = T, prob = 
  c(p, 1-p))
  wealth <- vector("integer", k)
  wealth[1] <- w_0

  for (i in 1:k) {
    wealth[i + 1] <- wealth[i]*toss[i]
  }

 return(wealth)
}


#One million simulations for our example
X = matrix(ncol = 1000000,nrow = 21)

for(i in 1:1000000){
  X[,i] <- kelly(1, .55, 20, 10)
}

test <- rowMeans(X)

#Growth rate

g_1 <- log(test[2]/test[1])
g_2 <- log(test[4]/test[1])/3
g_3 <- log(test[15]/test[1])/14
$\endgroup$
  • $\begingroup$ The Kelly criterion is an asymptotic optimal—as $k\to \infty$. I don’t think simulating $k=20$ games, one million times, is sufficiently accurate. $\endgroup$ – Nap D. Lover Apr 1 at 19:45
  • $\begingroup$ @LoveTooNap29 thanks for your comment. I have increased $k = 100000$ and the result still holds. No idea why this is happening! $\endgroup$ – migueldva Apr 2 at 4:56
4
$\begingroup$

You have an error in your code.

The logarithmic growth rate for $k$ bets with optimal fraction $\ell^*$ is

$$B=\frac{1}{k}\log\left(\frac{W_k}{W_0}\right) = \frac{1}{k} \sum_{j=1}^k\log(1+ \ell^*X_j),$$

where $X_1,X_2, \ldots$ are independent and identically distributed Bernoulli random variables with $P(X_j = 1) = p = 0.55$ and $P(X_j = -1) = q=1-p = 0.45$.

The expected growth rate is

$$E(B) = \frac{1}{k} \sum_{j=1}^k E[ \log(1+\ell^* X_j)] = E[\log(1+ \ell^*X_1)] = p\log(1 + \ell^*) + q\log(1 - \ell^*)$$

Note that the expected growth rate does not depend on $k$.

The variance of the growth rate is

$$var(B) = E(B^2) - [E(B)]^2 = p[\log(1+\ell^*)]^2+ q[\log(1-\ell^*)]^2 - [p\log(1+\ell^*) + q\log(1- \ell^*)]^2$$

For the given parameters we have

$$E(B) \approx0.005008,\,\,\,\, \sqrt{var(B)} \approx0.099832 $$

Your simulation generates a sequence of $k$ bets, computes the growth rate for the sequence and then repeats the process $n$ times. In the end, you compute the average of the growth rates for each sequence. Since the expected growth rate is independent of the length of the sequence you are effectively sampling the random variable $\log(1+\ell^*X_1)$ a total of $n \cdot k = 20,000,000$ times and computing the mean. The standard error of the estimate should be

$$SE = \frac{\sqrt{var(B)}}{\sqrt{nk}} \approx 0.000022$$

In fact, as $k$ is increased the distribution of $k$-bet growth rates approaches a normal distribution asymptotically by the central limit theorem.

This suggests that in many repetitions of the simulation the estimate of the expected value should be roughly $0.005008 \pm 2.32 * 0.000022 = 0.005008 \pm 0.000052$ with $99 \%$ confidence.

I ran the simulation myself and obtained estimates consistently close to $0.005$ using different random number seeds with only $100000$ simulation paths.

$\endgroup$
  • $\begingroup$ From what I understand and which also relates to @RandyF 's answer I'm effectively sampling the expected value of the growth rate of the first bet, which differs from the expectation of $B$. In order to sample the ev of $B$ I should simply increase the number of $k$ trials? $\endgroup$ – migueldva Apr 3 at 1:55
  • $\begingroup$ What I'm not sure I understand is your first statement, which mentions that $B$ measures the logarithmic growth for $k$ bets... shouldn't it measure the logarithmic growth per bet? $\endgroup$ – migueldva Apr 3 at 2:13
  • $\begingroup$ Yes -- that is a better description. $G_k = \frac{1}{k}\sum_{j=1}^k \log(1 + \ell^*X_j)$ is the growth rate per bet measured as an average over $k$ turns. $\endgroup$ – RRL Apr 3 at 2:30
  • $\begingroup$ If you take a relatively large $k$ -- $20$ is probably sufficient and then create a sample $G_{k1}, G_{k2}, \ldots, G_{kn}$ for a large number of paths, $n$. You will see that the distribution of $G_k$ looks normal. $\endgroup$ – RRL Apr 3 at 2:36
  • $\begingroup$ Ok, so that clarifies it. Just one more thing if you don't mind, in essence if I intend to show that the average growth rate per bet is indeed $B$, simulating a single game with a large number of trials is sufficient - instead of simulating a large number of $n$ games with $k$ trials. $\endgroup$ – migueldva Apr 3 at 2:37
2
$\begingroup$

If you were to just run a lot more simulations through the $kelly()$ function, you would get a growth rate much closer to the 0.005 you expect. If you think about this intuitively, during the first period, the expected return is 0.01, which is very close to the value you are getting. The reason the 0.005 is so different from the 0.01 is that the 0.005 is based on the log return.

Knowing that, if we move to the code as it is written, you are taking the mean across all paths and taking the log difference of the means. This methodology will dampen the effect of taking the log return, whereas you want the mean of the log returns.

$log(0.55*(1.1)+0.45(0.9)) = 0.00995; 0.55*log(1.1)+0.45*log(0.9) = 0.00501$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.