sport

About

Name sport is an abbreviation for Sequential Pairwise Online Rating Techniques. Package contains functions calculating ratings for two-player or multi-player matchups. Methods included in package are able to estimate ratings (players strengths) and their evolution in time, also able to predict output of challenge. Algorithms are based on Bayesian Approximation Method, and they don’t involve any matrix inversions nor likelihood estimation. sport incorporates methods such glicko, glicko2, bayesian Bradley-Terry, dynamic logistic regression. Parameters are updated sequentially, and computation doesn’t require any additional RAM to make estimation feasible. Additionally, base of the package is written in C++ what makes sport computation even faster.

Package Usage

Installation

Install package from CRAN or development version from github.

devtools::install_github("gogonzo/sport")
install.packages("sport",repos = "https://cloud.r-project.org/")

Available Data

Package contains actual data from Speedway Grand-Prix. There are two data.frames:

  1. gpheats - results SGP heats. Column rank is a numeric version of column position - rider position in race.
  2. gpsquads - summarized results of the events, with sum of point and final position.

Data used in sport package must be in so called long format. Typically data.frame contains at least id, name and rank, with one row for one player within specific match. Package allows for any number of players within event and allows ties also. For all games, output needs to be a rank/position in event. Don’t mix up rank output with typical 1-win, 0-lost. In sport package output for two player game is 1-winner 2-looser. Below example of two matches with 4 players each.

Estimate dynamic ratings

To compute ratings using each algorithms one has to specify formula. Form rank | id ~ name is required, which estimates name - rating of a player, by observing outputs - rank, nested within particular event

  • id. Variable names in formula are unrestricted, but model structure remains the same. All methods are named method_run. formula = rank|id ~ name

Output

Objects returned by method_run are of class rating and have their own print summary which provides most important informations. -print.sport shows condensed informations about model performance like accuracy and consistency of model predictions with observed probabilities. More profound summary are given by summary by showing ratings, ratings deviations and comparing model win probabilities with observed.

To visualize top n ratings with their 95% confidence interval one can use dedicated plot.rating function. For DBL method top coefficients are presented not necessarily ratings. It’s also possible to examine ratings evolution in time, by specifying players argument.

plot(glicko, n = 15)
plot(glicko, 
     players = c("Greg HANCOCK","Tomasz GOLLOB","Tony RICKARDSSON"))

Except dedicated print,summary and plot there is possibility to extract more detailed information to be analyzed. rating object contains following elements:

  • rating$final_r and rating$final_rd contains ratings and ratings deviations estimations.
  • r contains data.frame with sequential ratings estimations from first event to the last. Number of rows in r equals number of rows in input data.
  • pairs pairwise combinations of players in analyzed events with prior probability and result of a challenge.