glicko2_run: Glicko2 rating algorithm

Description Usage Arguments Value Examples

View source: R/rating_run.R

Description

Glicko2 rating algorithm

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
glicko2_run(
  formula,
  data,
  r = numeric(0),
  rd = numeric(0),
  sigma = numeric(0),
  lambda = NULL,
  share = NULL,
  weight = NULL,
  init_r = 1500,
  init_rd = 350,
  init_sigma = 0.05,
  kappa = 0.5,
  tau = 0.5
)

Arguments

formula

formula which specifies the model. RHS Allows only player rating parameter and it should be specified in following manner:

rank | id ~ player(name).

  • rank player position in event.

  • id event identifier in which pairwise comparison is assessed.

  • player(name) name of the contestant. In this case player(name) helps algorithm point name of the column where player names are stored.

Users can also specify formula in in different way: rank | id ~ player(name|team). Which means that players are playing in teams, and results are observed for teams not for players. For more see vignette.

data

data.frame which contains columns specified in formula, and optional columns defined by lambda, weight.

r

named vector of initial players ratings estimates. If not specified then r will be created automatically for parameters specified in formula with initial value init_r.

rd

rd named vector of initial rating deviation estimates. If not specified then rd will be created automatically for parameters specified in formula with initial value init_rd.

sigma

(only for glicko2) named vector of initial players ratings estimates. If not specified then sigma will be created automatically for parameters specified in formula with initial value init_sigma.

lambda

name of the column in 'data' containing lambda values or one constant value (eg. lambda = colname or lambda = 0.5). Lambda impact prior variance, and uncertainty of the matchup result. The higher lambda, the higher prior variance and more uncertain result of the matchup. Higher lambda flattens chances of winning.

share

name of the column in 'data' containing player share in team efforts. It's used to first calculate combined rating of the team and then redistribute ratings update back to players level. Warning - it should be used only if formula is specified with players nested within teams ('player(player|team)').

weight

name of the column in 'data' containing weights values or one constant (eg. weight = colname or weight = 0.5). Weights increasing (weight > 1) or decreasing (weight < 1) update change. Higher weight increasing impact of event result on rating estimate.

init_r

initial values for r if not provided. Default (glicko = 1500, glicko2 = 1500, bbt = 25, dbl = 0)

init_rd

initial values for rd if not provided. Default (glicko = 350, glicko2 = 350, bbt = 25/3, dbl = 1)

init_sigma

initial values for sigma if not provided. Default = 0.5

kappa

controls rd shrinkage not to be greater than rd*(1 - kappa). 'kappa=1' means that rd will not be decreased.

tau

The system constant. Which constrains the change in volatility over time. Reasonable choices are between 0.3 and 1.2 (default = 0.5), though the system should be tested to decide which value results in greatest predictive accuracy. Smaller values of tau prevent the volatility measures from changing by large amounts, which in turn prevent enormous changes in ratings based on very improbable results. If the application of Glicko-2 is expected to involve extremely improbable collections of game outcomes, then 'tau' should be set to a small value, even as small as, say, tau= 0.

Value

A "rating" object is returned:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# the simplest example
data <- data.frame(
  id = c(1, 1, 1, 1),
  team = c("A", "A", "B", "B"),
  player = c("a", "b", "c", "d"),
  rank_team = c(1, 1, 2, 2),
  rank_player = c(3, 4, 1, 2)
)

# Example from Glickman
glicko2 <- glicko2_run(
  data = data, 
  formula = rank_player | id ~ player(player),
   r = setNames(c(1500.0, 1400.0, 1550.0, 1700.0), c("a", "b", "c", "d")),
   rd = setNames(c(200.0, 30.0, 100.0, 300.0), c("a", "b", "c", "d"))
  )
  
# nested matchup
glicko2 <- glicko2_run(
  data = data, 
  formula = rank_team | id ~ player(player | team)
 )

elo2zero/sport documentation built on Jan. 8, 2020, 12:19 p.m.