gobbios / EloRating

Animal dominance hierarchies
4 stars 0 forks source link

difference between .elo.seq_old and elo.seq #9

Open rety03 opened 1 year ago

rety03 commented 1 year ago

I do not see any difference between .elo.seq_old and elo.seq, however I cannot change the start value when I use elo.seq. The code I wrote and the output is below.

CODE:

res1 <- EloRating:::.elo.seq_old( winner = season_1011_dates_elo$winner, loser = season_1011_dates_elo$loser, Date = season_1011_dates_elo$Date, draw = season_1011_dates_elo$Draw, startvalue = 500, k = 2, runcheck = TRUE, progressbar = FALSE ) summary(res1)

res_elo <- elo.seq( winner = season_1011_dates_elo$winner, loser = season_1011_dates_elo$loser, Date = season_1011_dates_elo$Date, draw = season_1011_dates_elo$Draw, startvalue = 500, k = 2, runcheck = TRUE, progressbar = FALSE ) summary(res_elo)

SUMMARY OUTPUT:

summary(res1) Elo ratings from 20 individuals total (mean/median) number of interactions: 380 (38/38) range of interactions: 38 - 38 date range: 2010-08-14 - 2011-05-22 startvalue: 500 uppon arrival treatment: average k: 2 proportion of draws in the data set: 0.29

summary(res_elo) Elo ratings from 20 individuals total (mean/median) number of interactions: 380 (38/38) range of interactions: 38 - 38 date range: 2010-08-14 - 2011-05-22 startvalue: 1000 uppon arrival treatment: average k: 2 proportion of draws in the data set: 0.29

Also, I also noticed that optimizek does not work with .elo.seq_old.

gobbios commented 1 year ago

That was a bug in the elo.seq function (introduced during a major overhaul, which led to the existence of elo.seq_old()), which prepared information to be used in the summary() function. This should be fixed now. Thanks for reporting this. Note that the actual ratings were calculated correctly.

To install the package with the bug fixed, please use

devtools::install_github("gobbios/EloRating")

library(EloRating)
data(adv)

r1 <- elo.seq(winner = adv$winner, loser = adv$loser, Date = adv$Date, startvalue = 500)
summary(r1) # startvalue: 500
mean(extract_elo(r1)) # 500

r2 <- elo.seq(winner = adv$winner, loser = adv$loser, Date = adv$Date, startvalue = 333)
summary(r2) # startvalue: 333
mean(extract_elo(r2)) # 333

# default is 1000
r3 <- elo.seq(winner = adv$winner, loser = adv$loser, Date = adv$Date)
summary(r3) # startvalue: 1000
mean(extract_elo(r3)) # 1000

The major overhaul mentioned above also is the reason why optimising k isn't working in the old version elo.seq_old() - it didn't exist yet.