# Glicko rating system

The Glicko rating system and Glicko-2 rating system are methods of assessing a player's strength in zero-sum two-player games. The Glicko rating system was invented by Mark Glickman in 1995 as an improvement on the Elo rating system and initially intended for the primary use as a chess rating system. Glickman's principal contribution to measurement is "ratings reliability", called RD, for ratings deviation.

## Overview

Mark Glickman created the Glicko rating system in 1995 as an improvement on the Elo rating system.
Both the Glicko and Glicko-2 rating systems are under public domain and have been implemented on game servers online like Counter-Strike: Global Offensive, Team Fortress 2, Dota 2, Guild Wars 2, Splatoon 2, Online-go.com, Lichess and Chess.com.
The Reliability Deviation (RD) measures the accuracy of a player's rating, where the RD is equal to one standard deviation. For example, a player with a rating of 1500 and an RD of 50 has a real strength between 1400 and 1600 (two standard deviations from 1500) with 95% confidence. Twice (exact: 1.96) the RD is added and subtracted from their rating to calculate this range. After a game, the amount the rating changes depends on the RD: the change is smaller when the player's RD is low (since their rating is already considered accurate), and also when their opponent's RD is high (since the opponent's true rating is not well known, so little information is being gained). The RD itself decreases after playing a game, but it will increase slowly over time of inactivity.
The Glicko-2 rating system improves upon the Glicko rating system and further introduces the rating volatility σ. A very slightly modified version of the Glicko-2 rating system is implemented by the Australian Chess Federation.

## The algorithm of Glicko
### Step 1: Determine ratings deviation

The new Ratings Deviation ($RD$) is found using the old Ratings Deviation ($RD_{0}$):
$RD=\min \left({\sqrt {{RD_{0}}^{2}+c^{2}t}},350\right)$
where $t$ is the amount of time (rating periods) since the last competition and '350' is assumed to be the RD of an unrated player. If several games have occurred within one rating period, the method treats them as having happened simultaneously. The rating period may be as long as several months or as short as a few minutes, according to how frequently games are arranged. The constant $c$ is based on the uncertainty of a player's skill over a certain amount of time. It can be derived from thorough data analysis, or estimated by considering the length of time that would have to pass before a player's rating deviation would grow to that of an unrated player. If it is assumed that it would take 100 rating periods for a player's rating deviation to return to an initial uncertainty of 350, and a typical player has a rating deviation of 50 then the constant can be found by solving $350={\sqrt {50^{2}+100c^{2}}}$ for $c$.
Or
$c={\sqrt {(350^{2}-50^{2})/100}}\approx 34.6$

### Step 2: Determine new rating

The new ratings, after a series of m games, are determined by the following equation:
$r=r_{0}+{\frac {q}{{\frac {1}{RD^{2}}}+{\frac {1}{d^{2}}}}}\sum _{i=1}^{m}{g(RD_{i})(s_{i}-E(s|r_{0},r_{i},RD_{i}))}$
where:
$g(RD_{i})={\frac {1}{\sqrt {1+{\frac {3q^{2}(RD_{i}^{2})}{\pi ^{2}}}}}}$
$E(s|r_{0},r_{i},RD_{i})={\frac {1}{1+10^{\left({\frac {g(RD_{i})(r_{0}-r_{i})}{-400}}\right)}}}$
$q={\frac {\ln(10)}{400}}=0.00575646273$
$d^{2}={\frac {1}{q^{2}\sum _{i=1}^{m}{(g(RD_{i}))^{2}E(s|r_{0},r_{i},RD_{i})(1-E(s|r_{0},r_{i},RD_{i}))}}}$
$r_{i}$ represents the ratings of the individual opponents.
$RD_{i}$ represents the rating deviations of the individual opponents.
$s_{i}$ represents the outcome of the individual games. A win is 1, a draw is ${\frac {1}{2}}$, and a loss is 0.

### Step 3: Determine new ratings deviation

The function of the prior RD calculation was to increase the RD appropriately to account for the increasing uncertainty in a player's skill level during a period of non-observation by the model. Now, the RD is updated (decreased) after the series of games:
$RD'={\sqrt {\left({\frac {1}{RD^{2}}}+{\frac {1}{d^{2}}}\right)^{-1}}}$

## Glicko-2 algorithm

Glicko-2 works in a similar way to the original Glicko algorithm, with the addition of a rating volatility $\sigma$ which measures the degree of expected fluctuation in a player’s rating, based on how erratic the player's performances are. For instance, a player's rating volatility would be low when they performed at a consistent level, and would increase if they had exceptionally strong results after that period of consistency. A simplified explanation of the Glicko-2 algorithm is presented below:

### Step 1: Compute ancillary quantities

Across one rating period, a player with a current rating $\mu$ and ratings deviation $\phi$ plays against $m$ opponents, with ratings $\mu _{1},...,\mu _{m}$ and RDs $\phi _{1},...,\phi _{m}$, resulting in scores $s_{1},...,s_{m}$. We first need to compute the ancillary quantities $v$ and $\Delta$:
$v=\left[\sum _{j=1}^{m}g(\phi _{j})^{2}E(\mu ,\mu _{j},\phi _{j})\{1-E(\mu ,\mu _{j},\phi _{j})\}\right]^{-1}$
$\Delta =v\sum _{j=1}^{m}g(\phi _{j})\{s_{j}-E(\mu ,\mu _{j},\phi _{j})\}$
where
$g(\phi _{j})={\frac {1}{\sqrt {1+3\phi _{j}^{2}/\pi ^{2}}}},$
$E(\mu ,\mu _{j},\phi _{j})={\frac {1}{1+\exp\{-g(\phi _{j})(\mu -\mu _{j})\}}}.$

### Step 2: Determine new rating volatility

We then need to choose a small constant $\tau$ which constrains the volatility over time, for instance $\tau =0.2$ (smaller values of $\tau$ prevent dramatic rating changes after upset results). Then, for
$f(x)={\frac {1}{2}}{\frac {e^{x}(\Delta ^{2}-\phi ^{2}-v-e^{x})}{(\phi ^{2}+v+e^{x})^{2}}}-{\frac {x-\ln({\sigma ^{2}})}{\tau ^{2}}},$
we need to find the value $A$ which satisfies $f(A)=0$. An efficient way of solving this would be to use the Illinois algorithm, a modified version of the regula falsi procedure (see Regula falsi § The Illinois algorithm for details on how this would be done). Once this iterative procedure is complete, we set the new rating volatility $\sigma '$ as
$\sigma '=\exp\{A/2\}.$

### Step 3: Determine new ratings deviation and rating

We then get the new RD
$\phi '=1{\Big /}{\sqrt {{\frac {1}{\phi ^{2}+\sigma '^{2}}}+{\frac {1}{v}}}},$
and new rating
$\mu '=\mu +\phi '^{2}\sum _{j=1}^{m}g(\phi _{j})\{s_{j}-E(\mu ,\mu _{j},\phi _{j})\}.$
These ratings and RDs are on a different scale than in the original Glicko algorithm, and would need to be converted to properly compare the two.