May 24, 2014

Minute Numbers, Massive Differentiators

How Run Rate in IPL or cricket in general works? If you ever wondered, this post demystifies this complex math in simpler words with example. We know the run rate is the rate at which runs are scored in a game, so how is this thing gets computed exactly? is this minute 0.01 difference in the run-rate is what that qualifies a team to the play-off and ditches the other teams that earned equal points and played cricket  that is equally competitive? Is this fair enough?

If you get a closer look, cricket is a game of crafting all those little beautiful moments. 0.01 mtr is the difference between an LBW and an inside edge. 0.01 mtr is the difference between a beautiful cover drive and a nick to first slip. 0.01 mtr is the difference between a legal wicket and a front-foot no-ball. 0.01 mtr is the difference between a spectacular catch at the boundary line (read pollard magic) and a game-changing six over long-on. When the entire game's outcome relies on such little things, why can't we rely on the same for a qualifier? 

It is a real challenge when three teams draw at 14 points, and you are asked to pick the best. Enter Mr.Mathematics who provides a solution in his typical 'formulae' style. This formulae, with a single number, brings out the team that won most convincingly, among the others. When two teams chase and win a game, the team that won with two overs to spare is definitely better than a team that won on the last ball. Similarly a team that wins by a margin of 40 runs is better than a team that just managed to win a game on the last ball by 4 runs. Run rate is that magical formula which clearly brings out this "convincingness" of a win.
"A team's net run rate is calculated by deducting from the average runs per over scored by that team throughout the season, the average runs per over scored against that team throughout the season", quotes cricinfo.com
  • Say two teams played 20 overs each, and If team 1 got 200, and team 2 got 190 during the chase, then the run rate of team 1 is  200/20 - 190/20 = 0.5. Team 2 on the other side, will get the exact opposite. a -0.5
  • In the same scenario, if team 2 chased down 200 in 18 overs, team 2 run rate will be 200/18 - 200/20 = 1.11, and team 1 will get a -1.11.

If team one gets 200 in 18 overs, and gets all out, still it will be counted as 20 overs. This is an exception to the rule when teams get all out. Even if team chasing 200 gets all out for 100 in 10 overs, they will still be counted as 100/20. This is good because if that rule is not applied, team batting first gets 150 in 20 overs (150/20 is 7.5) and team batting second gets all out for 50 in 5 overs, they get 50/5 = 10.0. So applying formula, team 1 for winning will get a -2.5. Every possible rule is well accounted in run rate. All the runs scored and conceded in every game is added together and run rate is arrived at. So this is perfect enough to identify which team has played better cricket. Here is the current IPL Points table, explaining the total runs scored and conceded by all teams.
"For" means run scored, "Against" indicates runs conceded. Data source: www.iplt20.com/stats

In this table, the top 4 teams will advance to the playoffs. While first 3 teams are already qualified, the 4th spot is the one that is being fought for by 3 teams, RR/MI/SRH. All these teams are likely to tie at 14 points at the end of 14 games, and run rate will decide who will be the 4th. MI has bowled 253.3 overs so far, and conceded 1981 runs. So the overs they will bowl to RR, and the runs RR scores will be added to this equation, and computed along with runs scored by MI. The process happens for both teams. Since this is an average of 14 games, MI really need to win by a large margin to cross RR's run rate.

So here is a assumption chart where in MI is assumed to have set a target of 200, and the run rate of both teams, based on RR's total is mentioned on the left side. See the center column "Win?" which indicates who wins with higher run rate, based on runs scored by both teams. If MI win by 43 runs, they are 0.01 ahead. On the right side is the chase chart for MI, where RR sets a target of 200 and MI needs to get it by 14.4 overs to win with the same 0.01 margin! I am not sure what will happen if target is 160 but this is how it works.

Assumptions: If MI chase, win before 14.4 overs, or if defend, win by 43 or more runs.

We are down to that 0.01 in the end, isn't it magical. That little beautiful thing!

So what factors does run rate does not consider, you may ask! That can be a topic for another blog, or for your to write in the comments section. Things like beating high ranked team or low ranked team, defending a target with tough bowling condition like dew factors are not factored into run rate calculation.

Apr 2, 2014

How to replace line break with comma in text pad

A friend of mine asked me how to search and replace new line characters on TextPad editor. Sometimes we want to form a comma seperated values of all data in a column. It takes time to edit this manually and form the list.

Fortunately, TextPad supports "regular expressions" using which may come handy on several occasions. It is fairly simple as long as you know that "\n" means a new line in the world of computers, and the awareness that TextPad supports Regular Expressions syntax.

Here is an example document with random words:
document with words in multiple lines
And you fire the replace operation by hitting F8.
Find What: type \n
Replace with: type , (or whatever character you need)
Check "Regular Expression" box before you search / replace
And it will be all merged on to the same line. This looks simple while for an user trying to do this on a several hundred line file, would give big sigh of relief after learning this.
Final result after the replace operation

You may also like these writeups

Related Posts with Thumbnails

Join our Gang