Learn R Programming

PlayerRatings (version 1.1-0)

steph: The Stephenson Rating System

Description

Implements the Stephenson rating system for estimating the relative skill level of players in two-player games such as chess. It extends the Glicko method by including a second parameter controlling player deviation across time, a bonus parameter, and a neighbourhood parameter.

Usage

steph(x, status = NULL, init = c(2200,300), gamma = 0, cval = 10, 
  hval = 10, bval = 0, lambda = 2, history = FALSE, sort = TRUE, 
  rdmax = 350, …)

Arguments

x

A data frame containing four variables: (1) a numeric vector denoting the time period in which the game took place (2) a numeric or character identifier for player one (3) a numeric or character identifier for player two and (4) the result of the game expressed as a number, typically equal to one for a player one win, zero for a player two win and one half for a draw.

status

A data frame with the current status of the system. If not NULL, this needs to be a data frame in the form of the ratings component of the returned list, containing variables named Player, Rating, Deviation, and optionally Games, Win, Draw, Loss and Lag, which are set to zero if not given.

init

The rating vector at which to initialize a new player not appearing in status. Must be a vector of length two giving the initial rating and initial deviation respectively. If different initializations for different players are required, this can be done using status. The initial deviation cannot be greater than rdmax.

gamma

A player one advantage parameter; either a single value or a numeric vector equal to the number of rows in x. Positive values favour player one, while negative values favour player two. This could represent the advantage of playing at home, or the advantage of playing white for chess. Note that this is not passed to predict.rating, which has its own gamma parameter.

cval

The c parameter, which controls the increase in the player deviations across time. Must be a single non-negative number. Note that both cval and hval increase player deviations, so if hval is not zero then cval should typically be lower than the corresponding parameter in glicko.

hval

The h parameter, which also controls the increase in the player deviations across time. Must be a single non-negative number.

bval

The bonus parameter, which gives a per game bonus to each player on the basis that players who play more often may improve irrespective of whether they win or lose. A single non-negative number. Note that this will create ratings inflation (i.e. ratings will increase over time).

lambda

The neighbourhood parameter, which shrinks player ratings towards their opponents. A single non-negative number.

history

If TRUE returns the entire history for each period in the component history of the returned list.

sort

If TRUE sort the results by rating (highest to lowest). If FALSE sort the results by player.

rdmax

The maximum value allowed for the rating deviation.

Not used.

Value

A list object of class "rating" with the following components

ratings

A data frame of the results at the end of the final time period. The variables are self explanatory except for Lag, which represents the number of time periods since the player last played a game. This is equal to zero for players who played in the latest time period, and is also zero for players who have not yet played any games.

history

A three dimensional array, or NULL if history is FALSE. The row dimension is the players, the column dimension is the time periods. The third dimension gives different parameters.

gamma

The player one advantage parameter.

cval

The c parameter.

hval

The h parameter.

bval

The bonus parameter.

lambda

The neighbourhood parameter.

type

The character string "Stephenson".

Details

The Stephenson rating system is a method for evaluating the skill of players. It was developed by Alec Stephenson in 2012 as a variant of his winning entry in a competition to find the most useful practical chess rating system, organized by Jeff Sonas on Kaggle, a platform for data prediction competitions. The precise details are given in the file doc/ChessRatings.pdf.

This implementation is written so that Glicko is obtained as a special case upon setting all of the parameters hval, bval and lambda to zero. Default values are roughly optimized for the chess data analyzed in the file doc/ChessRatings.pdf, using the binomial deviance criterion.

References

Glickman, M.E. (1999) Parameter estimation in large dynamic paired comparison experiments. J. R. Stat. Soc. Ser. C: Applied Statistics, 48(3), 377-394.

Glickman, M.E. (2001) Dynamic paired comparison models with stochastic variances. Journal of Applied Statistics, 28, 673-689.

See Also

glicko

Examples

Run this code
# NOT RUN {
afl <- aflodds[,c(2,3,4,7)]
robj <- steph(afl)
robj

robj <- steph(afl[afl$Week==1,])
for(i in 2:max(afl$Week)) robj <- steph(afl[afl$Week==i,], robj$ratings)
robj
# }

Run the code above in your browser using DataLab