eheinzen / elo

An R package to calculate Elo ratings
https://eheinzen.github.io/elo/
37 stars 3 forks source link

Only updated elo values avaiable? #36

Closed systats closed 5 years ago

systats commented 5 years ago

Hi great package! Is is only possible get pre-game elo scores and update afterwards?

eheinzen commented 5 years ago

I'm not quite sure what you mean. If you're using elo.run(), the pre- and post-update elos should be pretty easy to get:

> library(elo)
> e <- elo.run(score(points.Home, points.Visitor) ~ team.Home + team.Visitor + group(week), data = tournament, k = 20)
> head(as.data.frame(e))
              team.A                team.B       p.A wins.A    update    elo.A    elo.B
1 Blundering Baboons   Athletic Armadillos 0.5000000      0 -10.00000 1490.000 1510.000
2  Defense-less Dogs          Cunning Cats 0.5000000      1  10.00000 1510.000 1490.000
3     Fabulous Frogs          Elegant Emus 0.5000000      1  10.00000 1510.000 1490.000
4    Helpless Hyenas Gallivanting Gorillas 0.5000000      0 -10.00000 1490.000 1510.000
5       Cunning Cats   Athletic Armadillos 0.4712494      1  10.57501 1500.575 1499.425
6  Defense-less Dogs    Blundering Baboons 0.5287506      0 -10.57501 1499.425 1500.575

The post-game elos are in the last two columns, and you could easily take the update and add/subtract it to get the pre-game elo. You could also consider as.matrix(e) to get the elos after each grouping-variable (in this case, "week").

Does that help?

systats commented 5 years ago

Thanks. That was pretty obvious and much more efficient than going over as.matrix. We get pretty nice results from Elo compared to PI and Glicko2.

eheinzen commented 5 years ago

Fantastic! I'm glad you like the package, and glad you got this figured out! Don't hesitate to reach out with any other questions!