R/eloratingfixed.R
eloratingfixed.Rd
Conducts traditional elo rating analyses using specified K value
and outputs raw, normalized, cardinal, and categorical ranks as a list object in
R or in an output file. For optimized Elo parameters, use eloratingopt
.
eloratingfixed(agon_data, pres_data, k = 100, init_elo = 1000, outputfile = NULL,
returnR = TRUE, p_function = "sigmoid")
Input data frame with dominance interactions, should only contain Date, Winner, Loser. Date should be formatted as MONTH/DAY/YEAR, or already as Date class.
Input data frame with columns "id", "start_date" and "end_date". Date columns should be formatted as MONTH/DAY/YEAR, or already as Date class. If all IDs are present the whole time, you ignore this and a pres_data table will be automatically generated.
Specified value of the k parameter, default is 100
The starting Elo value for all individuals, default is 1000
Name of csv file to save ranks to. Default is NULL, in which case the function will only return a table in R. If you supply an output file name the function will save the results as a csv file in your working directory.
whether to return an R object from the function call. Default is TRUE
function defining probability of winning. Default "sigmoid" is
equation (1) from Foerster, Franz et al 2016. Use "pnorm" to use the
pnorm
-based method implemented in the EloRating package.
Returns a list with six elements:
Data frame with all IDs and dates they were present, with the following columns:
User-defined value of the k parameter
User-defined initial Elo score when individuals enter the hierarchy
Proportion of correctly predicted interactions
The overall log-likelihood of the observed data given the user-supplied parameter values based on winning probabilities (as calculated in equation (1) of Foerster, Franz et al 2016) for all interactions
This function accepts a data frame of date-stamped dominance interactions and
(optionally) a data frame of start and end dates for each individual to be ranked,
and outputs daily Elo scores with parameters specified by the user. The default function
used to determine probability of winning is equation (1) from Foerster, Franz et al. 2016,
but for ease of comparison with the EloRating package, we also added the option to use
the pnorm
-based method implemented in the EloRating package, and future
development will add the option to use the original function from Elo 1978 (as implemented in
the elo package). This function does not require large presence matrices, and efficiently
calculates a series of additional indices (described below).
As opposed to the eloratingopt
function, this procedure only requires that
included individuals have at least one win or one loss.
A detailed description of the function output is given in the Value section of this help file:
nbadata = EloOptimized::nba #nba wins and losses from the 1995-96 season
nbaelo = eloratingfixed(agon_data = nbadata)
#> k = 100
#> prediction accuracy = 0.636
# generates traditional Elo scores (with init_elo = 1000 & k = 100) and saves
# them as "nbaelo"