Simulating Kelly Betting and Checking a Replication Against Its Source
Summary
The document presents an R simulation intended to reproduce a Kelly capital growth example. It defines a set of bets with different win probabilities and odds, assigns probabilities to selecting each bet, and associates each with an optimal Kelly stake. The function repeatedly samples a bet, simulates whether it wins, applies a chosen fraction of the Kelly stake, and compounds wealth across decision points and simulations. It then reports the maximum, mean, and minimum terminal wealth from a sample run.
The response says the code works and clarifies that the paper's cited results come from a separate racetrack betting book identified in a table caption. That missing citation explains why the author could not readily locate the source of the table. The document does not show a direct numerical comparison with the original simulation, so it supports the code's operation but not a fully verified replication. Its output is also stochastic and depends on the specified probabilities, payouts, stake fractions, and random draws.
Key ideas
- The example simulates repeated bet selection, outcomes, Kelly stakes, and compounded wealth in R.
- Bet choices are sampled according to specified probabilities, with win rates and stakes tied to each choice.
- The response identifies a separate racetrack betting book as the source of the paper's reported table.
- The code is described as working, but no direct numerical replication check is shown.
- Simulation results depend on the assumptions and random draws used.
Tags
Full text
# Kelly Capital Growth Investment Strategy (Example in R)
# Kelly Capital Growth Investment Strategy (Example in R)
In the paper Response to Paul A Samuelson letters and papers onthe Kelly Capital Growth Investment Strategy pages 5 and 6 Dr William T Ziemba, gives a praticle example on Kelly Growth.
I’m trying to replicate the simulation explained there on R :
Step 1 : Create the Table as da Data.Frame
```
Win.Prob <- c(0.57,0.38,0.285,0.228,0.19)
Odds <- c("1-1","2-1","3-1","4-1","5-1")
Implied.Odds <-c(0.5,0.333,0.25,0.2,0.167)
Edge <- c(0.07,0.0467,0.035,0.028,0.0233)
Advantage <- c(0.14,0.14,0.14,0.14,0.14)
Opt.Kelly <- c(0.14,0.07,0.0467,0.035,0.028)
Prob.Chose.Bet <- c(0.1,0.3,0.3,0.2,0.1)
Cum.Prob.Bet <- c(0.1,0.4,0.7,0.9,1)
Kelly.Example <- data.frame(Win.Prob,Odds,Implied.Odds,Edge,Advantage,Opt.Kelly,Prob.Chose.Bet,Cum.Prob.Bet)
remove(Win.Prob,Odds,Implied.Odds,Edge,Advantage,Opt.Kelly,Prob.Chose.Bet,Cum.Prob.Bet)
```
Step 2 : Create the function that replicates the simulation
```
# Initiate the function that takes 3 variables (Initial Wealth, Decision Points, Number of Simulations)
kelly.simulation <- function(InitialWealth,SimulationNumber,SimulationSteps,KellyFraction) {
#Initiate a Matrix that generates SimulationSteps*SimulationNumber random numbers and Attribute to the Bet choice
simu_bets <- matrix(sample.int(5, size = SimulationSteps*SimulationNumber, replace = TRUE, prob = c(.1,.3,.3,.2,.1)),nrow=SimulationSteps,ncol=SimulationNumber)
#Take the chosen bet in simu_bets and create a new matrix of Optimal Kelly Bets based on the table in Kelly.Example
simu_kellybets <- ifelse(simu_bets == 1,Kelly.Example$Opt.Kelly[1],
ifelse(simu_bets == 2,Kelly.Example$Opt.Kelly[2],
ifelse(simu_bets == 3,Kelly.Example$Opt.Kelly[3],
ifelse(simu_bets == 4,Kelly.Example$Opt.Kelly[4],Kelly.Example$Opt.Kelly[5]))))
#Take the chosen bet in simu_bets and create a new matrix of Winning Probability based on the table in Kelly.Example
simu_prob <- ifelse(simu_bets == 1,Kelly.Example$Win.Prob[1],
ifelse(simu_bets == 2,Kelly.Example$Win.Prob[2],
ifelse(simu_bets == 3,Kelly.Example$Win.Prob[3],
ifelse(simu_bets == 4,Kelly.Example$Win.Prob[4],Kelly.Example$Win.Prob[5]))))
#Generate a new matrix of random number and compare to the prob of winning 1 means you won the bet 0 means you lost
simu_rnd <- matrix(runif(SimulationSteps*SimulationNumber,0,1),nrow=SimulationSteps,ncol=SimulationNumber)
simu_results <- ifelse(simu_prob>=simu_rnd,1,0)
#Generate a new matrix simu_results * simu_bets and creat the wealth simulation over each timestep
bet_combined <- simu_results * simu_bets
bet_combined[bet_combined==0] <- -1
multiplier <- 1 + simu_kellybets * bet_combined*KellyFraction
Wealth_Matrix <- apply(rbind(InitialWealth, multiplier), 2, cumprod)
row.names(Wealth_Matrix) <- NULL
#return the variation of wealth over each step for the defined number of simulations (Rows = Each Bet Decision Point / Column = Each simulation)
return(Wealth_Matrix)
}
```
Step 3 : Run the Simulation and Attribute the Resulting Matrix to a Variable called kelly.sim with 700 steps and 1000 simulations and Fraction = 1
```
kelly.sim <- kelly.simulation(InitialWealth=1000,SimulationNumber=1000,SimulationSteps=700,KellyFraction=1)
```
Step 4 : Check the results of the last row of the simulations (in the example row number 701)
```
max(kelly.sim[701,])
[1] 47800703
mean(kelly.sim[701,])
[1] 270680.9
min(kelly.sim[701,])
[1] 3.377048
```
In your oppinion these code replicates the simulation described in the paper ?
## Answer by Nikos (score 1)
https://quant.stackexchange.com/a/15918
As the paper suggests, the results that are shown in table 2 are taken from (if you read the caption)
> Ziemba, William T., and Donald B. Hausch, Betting at the Racetrack (New York: Norris M. Strauss, 1986)
The citation is not included for some reason, hence your confusion.
Your code works fine by the way.
ThanksShown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.