Duckworth-Lewis-Stern calculator to calculate the revised target

0 votes

With the Cricket World Cup going on, I wanted to create a Duckworth-Lewis calculator of my own for One Day Internationals using R.

This is a challenge I assigned myself, to push myself in understanding more on R, and what I could do. Duckworth-Lewis is an algorithm used in cricket when unexpected delays (notably bad weather) takes centre stage. The algorithm (in One Day Internationals) involves calculating Team 2's Par Score, which is where 'Team 2 Target' equals 'Team 1 Score' times the quotient of 'Team 2 Resources' and 'Team 1 Resources', and we add 1 to find the target (otherwise it creates room for a South Africa 2003 World Cup scenario).

team2_target = function(team1_score, team1_resources, team2_resources) {
  return((team1_score * (team2_resources/team1_resources) + 1)
}

I want to make my function use the number of wickets lost, as well as the overs remaining to calculate the 'Team 2 Resources' variable. For example, if Team 1 scored 277 out of its full 50 overs and Team 2 scored 240, with the loss of 4 wickets after 40 overs, I want to be able to use the 'Overs' and 'Wickets Lost' as variables. It sounds really simple, but both these factors matter, and if either of my desired variables change, the team2_resources variable itself will change

Feb 24, 2022 in Database by Edureka
• 13,690 points
668 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

From the "Interruption" menu, select Team 2's innings to be postponed.
Put 30 in the "Overs available" box for Team 1.

To inform the calculator how many runs Team 1 scored, enter 231 in the box.

In the "Overs available" variable for Team 2, enter 28.

According to the DLS technique, Team 2 requires 221 runs to win.

Team 2's par score = S * (R2/R1) = 231 * (71.8/75.1) = 220.85

Team 1 scored 268 runs from 50 overs, while Team 2 got to 229 runs from 45 overs and lost 6 wickets. Using our Duckworth Lewis calculator, let's see if Team 2 won.

  1. Select Team 2's innings cut short from the "Interruption" option.
  2. Enter 50 overs and 268 runs for Team 1.
  3. Enter 45 overs and 6 wickets lost for Team 2.
  4. We get a target of 230 runs for Team 2 to win the match.
  5. Entering Team 2's 229 runs that they scored, we see that the match is a draw, according to the Duckworth Lewis algorithm.

Calculating this result manually using the resources table, we first lookup the resources Team 2 couldn't use. They had 5 overs left after losing 6 wickets, corresponding to 14.3% of resources. Therefore, Team 2 used 100% - 14.3% = 85.7% during their innings. Calculating Team 2's par score:

Team 2's par score = S * (R2/R1) = 268 * (85.7/100) = 229.68

Rounding this up, we get a target to win for Team 2 of 221 runs.

answered Mar 2, 2022 by gaurav
• 23,260 points

edited Mar 5

Related Questions In Database

0 votes
2 answers

What are the ways to get the count of records in a table

With the help of the SQL count ...READ MORE

answered Aug 20, 2020 in Database by Okugbe
• 280 points
4,230 views
0 votes
2 answers

Write a SQL query to find the names of employees that begin with ‘S’

Select ename From emp Where ename like"s%"; READ MORE

answered Oct 7, 2021 in Database by anonymous
27,825 views
0 votes
1 answer

What is the SQL query to get the third highest salary of an employee from employee_table

You can try out something like this: SELECT ...READ MORE

answered Sep 27, 2018 in Database by Sahiti
• 6,370 points
13,251 views
0 votes
1 answer

What are the steps performed by Migration Wizard while migrating a database to MySQL?

The following are the steps  performed by ...READ MORE

answered Dec 10, 2018 in Database by Sahiti
• 6,370 points
1,035 views
0 votes
1 answer

How to display the queries executed by a particular user in MySQL?

From the version 5.1.7 onward, MySQL allows ...READ MORE

answered Mar 7, 2019 in Database by Mishti
• 480 points
4,676 views
0 votes
1 answer
0 votes
1 answer

Big Data transformations with R

Dear Koushik, Hope you are doing great. You can ...READ MORE

answered Dec 18, 2017 in Data Analytics by Sudhir
• 1,570 points
1,197 views
0 votes
2 answers

Transforming a key/value string into distinct rows in R

We would start off by loading the ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
1,467 views
0 votes
1 answer

Finding frequency of observations in R

You can use the "dplyr" package to ...READ MORE

answered Mar 26, 2018 in Data Analytics by Bharani
• 4,660 points
6,033 views
0 votes
1 answer

Left Join and Right Join using "dplyr"

The below is the code to perform ...READ MORE

answered Mar 27, 2018 in Data Analytics by Bharani
• 4,660 points
1,382 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP