Problem 56483. Cricket - Average Partnership Contribution

The (infamous) Duckworth-Lewis method uses statistical models of how much each wicket partnership is worth to an innings (on average). Given an 10-by-n matrix representing the score at the end of each partnership (either by the fall of a wicket or the innings ending) for n innings, return a 10-element vector that gives the average proportion of the total score each wicket contributes. For innings that are completed without all 10 wickets falling, there will be NaNs for the partnerships that did not occur. (This means the total team score is the last non-NaN value in each column.) The average across the n sample innings should ignore NaNs.
If the total innings score is 200 and the first wicket fell at a score of 40, the first wicket was worth 0.2 of the total. If the second wicket fell at 60, it was worth 20 runs = 0.1 of the total. And so on.
A two-column matrix of nondecreasing values, with the last non-NaN value highlighted in each column. This is converted to another 2-column matrix of the differences from row to row. The total score is shown below, being the highlighted values from before. The matrix is again converted to a new 2-column matrix where each value is the proportion of the total (given by the total score values from before). Finally, a column vector is calculated from the matrix by averaging across the columns.
x = [0 50;20 80;30 120;70 130;70 140;80 180;100 180;110 200;140 NaN;150 NaN]
x =
0 50
20 80
30 120
70 130
70 140
80 180
100 180
110 200
140 NaN
150 NaN
avg = partnershipcontrib(x)
avg =

Solution Stats

55.0% Correct | 45.0% Incorrect
Last Solution submitted on Dec 10, 2023

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers29

Suggested Problems

More from this Author22

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!