6 Emulating Duckworth-Lewis Table

Finally we seek to emulate the Duckworth-Lewis table by fitting a smooth function to first-innings data to model resources left (i.e. proportion of total runs a team can expect to score until the end of the innings) as a function of overs and wickets. We will then compare our results to the Duckworth-Lewis table itself.

first_inning = subset(gamelog,Inning==1)
first_inning$Over2 <- first_inning$Over + first_inning$Ball/6
first_inning$prop <- 0
for (match in unique(home$MatchNo)) { #home created earlier to determine runs for home team in each match
  total_runs = as.integer(subset(home,MatchNo==match,home))
  first_inning$prop[first_inning$MatchNo==match] = 
    first_inning$RunsScored[first_inning$MatchNo==match]/total_runs
}

loss_function = function(x,prop) {
  A = x[1]
  B = x[2]
  C = x[3]
  D = x[4]
  E = x[5]

  prop_smooth = with(first_inning,A*Over2 + B*Wickets + C*Over2^2 + D + E*Over2*Wickets)
  error = sum((prop - prop_smooth)^2)
  return(error)
}

par_grid <- expand.grid(seq(0.02,0.1,0.02),seq(0.02,0.1,0.02),seq(0,0.05,0.025),
                        0,c(0,0.05,0.025))
best_value = 1000000 #arbitrarily large
best_par <- rep(0,5) #initialize best parameters arbitrarily

gc()
for (i in 1:nrow(par_grid)){
  gc()
  print(i)
  start = par_grid[i,]
  opt <- optim(start,loss_function,prop=first_inning$prop)
  if (opt$value < best_value) {
    best_value = opt$value
    best_par = opt$par
  }
}
A <- best_par[1]
B <- best_par[2]
C <- best_par[3]
D <- best_par[4]
E <- best_par[5]

newDLT <- DLS
for (over in 1:20) {
  newDLT[over,] = round(1 - (A*over + B*(0:9) + C * over^2 + D +E*over*(0:9)),3)
}

newDLT - DLS
##         Wicket 0 Wicket 1 Wicket 2 Wicket 3 Wicket 4 Wicket 5 Wicket 6 Wicket 7 Wicket 8 Wicket 9
## Over 0    -0.051   -0.061   -0.061   -0.044   -0.008    0.056    0.152    0.279    0.402    0.487
## Over 1    -0.051   -0.063   -0.061   -0.048   -0.015    0.046    0.138    0.260    0.384    0.471
## Over 2    -0.052   -0.063   -0.063   -0.052   -0.020    0.035    0.121    0.242    0.365    0.455
## Over 3    -0.054   -0.063   -0.065   -0.054   -0.026    0.024    0.107    0.222    0.344    0.437
## Over 4    -0.056   -0.064   -0.068   -0.057   -0.032    0.014    0.092    0.202    0.324    0.418
## Over 5    -0.058   -0.067   -0.070   -0.062   -0.039    0.004    0.076    0.181    0.301    0.397
## Over 6    -0.058   -0.068   -0.071   -0.063   -0.044   -0.005    0.061    0.159    0.277    0.376
## Over 7    -0.061   -0.069   -0.071   -0.067   -0.050   -0.013    0.046    0.138    0.252    0.353
## Over 8    -0.063   -0.070   -0.074   -0.068   -0.054   -0.023    0.032    0.118    0.228    0.329
## Over 9    -0.065   -0.071   -0.075   -0.070   -0.059   -0.031    0.017    0.096    0.202    0.303
## Over 10   -0.066   -0.072   -0.074   -0.073   -0.062   -0.039    0.004    0.075    0.174    0.276
## Over 11   -0.068   -0.074   -0.075   -0.074   -0.064   -0.044   -0.007    0.056    0.146    0.248
## Over 12   -0.069   -0.073   -0.075   -0.073   -0.065   -0.050   -0.018    0.037    0.120    0.219
## Over 13   -0.071   -0.073   -0.074   -0.073   -0.067   -0.052   -0.027    0.018    0.093    0.189
## Over 14   -0.072   -0.073   -0.074   -0.072   -0.066   -0.053   -0.035    0.004    0.067    0.159
## Over 15   -0.074   -0.072   -0.072   -0.070   -0.064   -0.055   -0.039   -0.009    0.043    0.126
## Over 16   -0.074   -0.072   -0.070   -0.067   -0.061   -0.052   -0.040   -0.017    0.024    0.092
## Over 17   -0.074   -0.071   -0.066   -0.061   -0.057   -0.049   -0.039   -0.023    0.007    0.063
## Over 18   -0.075   -0.067   -0.062   -0.056   -0.051   -0.041   -0.033   -0.021   -0.002    0.035
## Over 19   -0.074   -0.066   -0.058   -0.050   -0.042   -0.032   -0.024   -0.014   -0.003    0.018
## Over 20    0.000    0.000    0.000    0.000    0.000    0.000    0.000    0.000    0.000    0.000

Taking a look at the difference between the generated and actual Duckworth-Lewis tables, we see that there is an enormous divergence in the values towards the upper right of the table (i.e. few overs played and many wickets lost). This was to be expected as these combinations of overs played and wickets lost are either very rarely encountered or even impossible (at most six wickets can be lost per over, so it doesn’t make sense to talk about more than six wickets lost in the first over). For combinations of overs played and wickets lost which are more frequently encountered, there is much better agreement between the two, with the difference in resources left never exceeding a magnitude of 0.1. The agreement is best especially in the last five overs of the game, when the deviation between the two is capped at a magnitude of 0.07 and often less than 0.05.

In conclusion, the smoothed results match Duckworth-Lewis values quite well for frequently encountered combinations of overs played & wickets lost. Besides the aforementioned rare combinations of wickets and overs, we can also observe that the new DLT we developed always indicates a lower value of remaining resources than the original DLS table when there are 4 or less wickets (since newDLT - DLS < 0 for the first 5 columns) but indicates a higher value when there are more wickets.