glicko v0.4.0 Glicko.Player

Provides convenience functions that handle conversions between Glicko versions one and two.

Usage

Create a v1 player with the default values for an unrated player.

iex> Player.new_v1
{1.5e3, 350.0}

Create a v2 player with the default values for an unrated player.

iex> Player.new_v2
{0.0, 2.014761872416068, 0.06}

Create a player with custom values.

iex> Player.new_v2([rating: 3.0, rating_deviation: 2.0, volatility: 0.05])
{3.0, 2.0, 0.05}

Convert a v2 player to a v1. Note this drops the volatility.

iex> Player.new_v2 |> Player.to_v1
{1.5e3, 350.0}

Convert a v1 player to a v2.

iex> Player.new_v1 |> Player.to_v2(0.06)
{0.0, 2.014761872416068, 0.06}

Note calling to_v1 with a v1 player or likewise with to_v2 and a v2 player will pass-through unchanged. The volatility arg in this case is ignored.

iex> player_v2 = Player.new_v2
iex> player_v2 == Player.to_v2(player_v2)
true

Link to this section Summary

Functions

The recommended initial rating value for a new player

The recommended initial rating deviation value for a new player

The recommended initial volatility value for a new player

Creates a new v1 player

Creates a new v2 player

A version agnostic method for getting a player’s rating

A version agnostic method for getting a player’s rating deviation

A convenience function for summarizing a player’s strength as a 95% confidence interval

Scales a player’s rating deviation

Scales a player’s rating

Converts a v2 player to a v1

A version agnostic method for getting a player’s volatility

Link to this section Types

Link to this type rating()
rating() :: float()
Link to this type rating_deviation()
rating_deviation() :: float()
Link to this type t()
t() :: v1() | v2()
Link to this type version()
version() :: :v1 | :v2
Link to this type volatility()
volatility() :: float()

Link to this section Functions

Link to this function initial_rating(version)
initial_rating(version()) :: rating()

The recommended initial rating value for a new player.

Link to this function initial_rating_deviation(version)
initial_rating_deviation(version()) :: rating_deviation()

The recommended initial rating deviation value for a new player.

Link to this function initial_volatility()
initial_volatility() :: volatility()

The recommended initial volatility value for a new player.

Link to this function new_v1(opts \\ [])
new_v1([rating: rating(), rating_deviation: rating_deviation()]) :: v1()

Creates a new v1 player.

If not overriden, will use the default values for an unrated player.

Link to this function new_v2(opts \\ [])
new_v2([rating: rating(), rating_deviation: rating_deviation(), volatility: volatility()]) :: v2()

Creates a new v2 player.

If not overriden, will use default values for an unrated player.

Link to this function rating(player, as_version \\ nil)
rating(player :: t(), as_version :: version()) :: rating()

A version agnostic method for getting a player’s rating.

Link to this function rating_deviation(player, as_version \\ nil)
rating_deviation(player :: t(), as_version :: version()) :: rating_deviation()

A version agnostic method for getting a player’s rating deviation.

Link to this function rating_interval(player, as_version \\ nil)

A convenience function for summarizing a player’s strength as a 95% confidence interval.

The lowest value in the interval is the player’s rating minus twice the RD, and the highest value is the player’s rating plus twice the RD. The volatility measure does not appear in the calculation of this interval.

An example would be if a player’s rating is 1850 and the RD is 50, the interval would range from 1750 to 1950. We would then say that we’re 95% confident that the player’s actual strength is between 1750 and 1950.

When a player has a low RD, the interval would be narrow, so that we would be 95% confident about a player’s strength being in a small interval of values.

Link to this function scale_rating_deviation_to(rating_deviation, version)
scale_rating_deviation_to(rating_deviation :: rating_deviation(), to_version :: version()) :: rating_deviation()

Scales a player’s rating deviation.

Link to this function scale_rating_to(rating, version)
scale_rating_to(rating :: rating(), to_version :: version()) :: rating()

Scales a player’s rating.

Link to this function to_v1(arg)
to_v1(player :: t()) :: v1()

Converts a v2 player to a v1.

A v1 player will pass-through unchanged.

Note the volatility field used in a v2 player will be lost in the conversion.

Link to this function to_v2(player, volatility \\ initial_volatility())
to_v2(player :: t(), volatility :: volatility()) :: v2()

Converts a v1 player to a v2.

A v2 player will pass-through unchanged with the volatility arg ignored.

Link to this function volatility(player, default_volatility \\ initial_volatility())
volatility(player :: t(), default_volatility :: volatility()) :: volatility()

A version agnostic method for getting a player’s volatility.