rating

How To Calculate the Elo-Rating (including Examples)

In sports, most notably in chess, baseball and basketball, the Elo-rating system is used to rank players. The rating is also helpful in deducing win probabilities (see my blog post Elo-Rating and Win Probability for more details on that). Suppose two players or teams with the current ratings r(1) and r(2) compete in a match. What will be their updated rating r'(1) and r'(2) after said match? Let’s do this step by step, first in general terms and then in a numerical example.

The first step is to compute the transformed rating for each player or team:

R(1) = 10r(1)/400

R(2) = 10r(2)/400

This is just to simplify the further computations. In the second step we calculate the expected score for each player:

E(1) = R(1) / (R(1) + R(2))

E(2) = R(2) / (R(1) + R(2))

Now we wait for the match to finish and set the actual score in the third step:

S(1) = 1 if player 1 wins / 0.5 if draw / 0 if player 2 wins

S(2) = 0 if player 1 wins / 0.5 if draw / 1 if player 2 wins

Now we can put it all together and in a fourth step find out the updated Elo-rating for each player:

r'(1) = r(1) + K * (S(1) – E(1))

r'(2) = r(2) + K * (S(2) – E(2))

What about the K that suddenly popped up? This is called the K-factor and basically a measure of how strong a match will impact the players’ ratings. If you set K too low the ratings will hardly be impacted by the matches and very stable ratings (too stable) will occur. On the other hand, if you set it too high, the ratings will fluctuate wildly according to the current performance. Different organizations use different K-factors, there’s no universally accepted value. In chess the ICC uses a value of K = 32. Other approaches can be found here.

—————————————–

Now let’s do an example. We’ll adopt the value K = 32. Two chess players rated r(1) = 2400 and r(2) = 2000 (so player 2 is the underdog) compete in a single match. What will be the resulting rating if player 1 wins as expected? Let’s see. Here are the transformed ratings:

R(1) = 102400/400 = 1.000.000

R(2) = 102000/400 = 100.000

Onto the expected score for each player:

E(1) = 1.000.000 / (1.000.000 + 100.000) = 0.91

E(2) = 100.000 / (1.000.000 + 100.000) = 0.09

This is the actual score if player 1 wins:

S(1) = 1

S(2) = 0

Now we find out the updated Elo-rating:

r'(1) = 2400 + 32 * (1 – 0.91) = 2403

r'(2) = 2000 + 32 * (0 – 0.09) = 1997

Wow, that’s boring, the rating hardly changed. But this makes sense. By player 1 winning, both players performed according to their ratings. So no need for any significant changes.

—————————————–

What if player 2 won instead? Well, we don’t need to recalculate the transformed ratings and expected scores, these remain the same. However, this is now the actual score for the match:

S(1) = 0

S(2) = 1

Now onto the updated Elo-rating:

r'(1) = 2400 + 32 * (0 – 0.91) = 2371

r'(2) = 2000 + 32 * (1 – 0.09) = 2029

This time the rating changed much more strongly.

—————————————–

Sports: Elo-Rating and Win Probability / Carlsen vs. Anand

The Elo rating system is a commonly applied tool to judge the performance of players in sports. Most associate it with chess, but it is in use in other sports as well, for example American Major League Baseball and Basketball. A nice thing about the rating system is that you can easily estimate the win probabilities given the difference in Elo rating of the opponents.

ELO

So if the difference is zero (opponents of equal strength), the win probability is obviously 0.5 = 50 %. If one player has a 200 Elo points advantage, his win probability is about 76 %. In case you prefer a table over a graph, you can find the corresponding values here. And for those interested in formulas, I found that the Boltzmann function models the values extremely well (r stands for Elo rating, p for the win probability):

p = 1 – 1 / ( 1 + exp ( 0.00583 * r  – 0.0505) )

For example, plugging in r = 200 leads to p = 0.75 = 75 %, close enough. For a very rough linear approximation this formula will do:

p = 0.5 + 0.001 * r

By the way, what sports event is happening right now in India? Right, the World Chess Championship. At the moment Anand and Carlsen are locked in a bitter battle to death (ok, a little too dramatic, but still very interesting) and I just finished watching their brilliant third match, which was yet another draw. Here’s the current top ten for chess:

Rank Name Title Country Rating Games B-Year
 1  Carlsen, Magnus  g  NOR  2870  0  1990
 2  Aronian, Levon  g  ARM  2801  6  1982
 3  Kramnik, Vladimir  g  RUS  2793  9  1975
 4  Nakamura, Hikaru  g  USA  2786  17  1987
 5  Grischuk, Alexander  g  RUS  2785  17  1983
 6  Caruana, Fabiano  g  ITA  2782  25  1992
 7  Gelfand, Boris  g  ISR  2777  11  1968
 8  Anand, Viswanathan  g  IND  2775  0  1969
 9  Topalov, Veselin  g  BUL  2774  6  1975
 10  Mamedyarov, Shakhriyar  g  AZE  2757  11  1985

As you can see, Carlsen is currently the leading chess player with an Elo rating of 2870 and Anand is on rank eight with a rating of 2775. The difference is 2870 – 2775 = 95 points, which translates into a win probability of about 63 % for Carlsen and 37 % for Anand. If you have to bet, bet on Carlsen, but it’s going to be a close one. Both have shown a great performance so far, though it seemed that in the third match Anand did miss some opportunities. I’m looking forward to tomorrow’s match.

Quantitative Analysis of Top 60 Kindle Romance Novels

I did a quantitative analysis of the current Top 60 Kindle Romance ebooks. Here are the results. First I’ll take a look at all price related data and conclusions.

—————————————————————————–

  • Price over rank:

pricerank

There seems to be no relation between price and rank. A linear fit confirmed this. The average price was 3.70 $ with a standard deviation of 2.70 $.

—————————————————————————–

  • Price frequency count:

pricescount

(Note that prices have been rounded up) About one third of all romance novels in the top 60 are offered for 1 $. Roughly another third for 3 $ or 4 $.

—————————————————————————–

  • Price per 100 pages over rank:

pricerank

Again, no relation here. The average price per 100 pages was 1.24 $ with a standard deviation of 0.86 $.

—————————————————————————–

  • Price per 100 pages frequency count:

PPP1

About half of all novels in the top 60 have a price per 100 pages lower than 1.20 $. Another third lies between 1.20 $ and 1.60 $.

—————————————————————————–

  • Price per 100 pages over number of pages:

PPP2

As I expected, the bigger the novel, the less you pay per page. Romance novels of about 200 pages cost 1.50 $ per 100 pages, while at 400 pages the price drops to about 1 $ per 100 pages. The decline is statistically significant, however there’s a lot of variation.

—————————————————————————–

  • Review count:

reviewscount

A little less than one half of the top novels have less than 50 reviews. About 40 % have between 50 and 150 reviews. Note that some of the remaining 10 % more than 600 reviews (not included in the graph).

—————————————————————————–

  • Rating over rank:

rankreviews

There’s practically no dependence of rank on rating among the top 60 novels. However, all have a rating of 3.5 stars or higher, most of them (95 %) 4 stars or higher.

—————————————————————————–

  • Pages over ranking:

pagesrank

There’s no relation between number of pages and rank. A linear fit confirmed this. The average number of pages was 316 with a standard deviation of 107.

—————————————————————————–

  • Pages count:

pagescount

About 70 % of the analyzed novels have between 200 and 400 pages. 12 % are below and 18 % above this range.