| pitelo | R Documentation |
Function to calculate ELO ratings from a pit stop dataset
pitelo(
pits_data,
stat_fun = 1,
calc = 1,
k = 20,
c = 10,
d = 400,
fml = TRUE,
elo = NULL
)
pits_data |
Tibble data generated by the pits() function |
stat_fun |
Type of stat used in ELO calculations: median (1, by default), mean (2) and min value (3) position |
calc |
Type of calculation: batch (1, by default) or sequential (2) |
k |
Weight factor magnitude (velocity) to change ELO ratings (by default, 20) |
c |
Base factor that establishes the win probability ratio between two teams for a given rating difference in the score ELO calculation (by default, 10) |
d |
Scaling factor amplitude that determines the sensitivity of the expected win probability to rating differences in the score ELO calculation (by default, 400) |
fml |
Team family mode. Collapse the different names of the same team structure (by default TRUE, enabled) |
elo |
ELO provided (if is omitted, 1000 will be used for all by default) |
The function calculates ELO ratings, using the position of each team's pit stop in each round.
By default, the median stat is used because it better reflects global pit stop performance across teams. It is less sensitive to extreme real data values and outliers, but provides more stability than the mean. For example, a single poor pit stop does not significantly affect efficiency.
Meanwhile, the mean is more affected by small sample sizes or outliers, such as penalties served by a driver during pit stops, but it is more sensitive to pit stop mistakes.
The last statistic uses the best pit stop result by team, ignoring consistency and reflecting maximum peak of performance potential.
On the other hand, two methodologies can be applied for ELO calculation: sequential or batch.
In the sequential approach, the ELO is updated after each match intra-event, so depends on the order in which matchups are processed. This changes future expectations within the same race, reinforcing early leadership while reducing later gains for the leader and smoothing final differences. Consequently, this approach is more suitable for analyzing individual races.
In contrast, the batch approach updates the ELO only after the entire event has finished. Race matchups are not considered immediately; instead they are aggregated afterward, making long-term comparisons more fair, neutral and independent of temporal order.
k parameter controls the magnitude of change in each ELO cycle calculation.
c establishes the win probability ratio between two teams based on a specific difference in rating points.
d is the expected probability to win (sensitivity).
Default values k, c and d used are based on Hvattum and Arntzen (2010). With these default values, a 400 point ELO difference implies that the stronger team has 10 times more chances of winning than the weaker team.
A tibble containing the ELO calculations
Elo, A. E. (1978). The rating of chessplayers, past and present. Arco Publishing. ISBN-10: 0668047216.
Glickman, M. E., & Jones, A. C. (1999). Rating the chess rating system. CHANCE-BERLIN THEN NEW YORK-, 12, 21-28.
Hvattum, L. M., & Arntzen, H. (2010). Using ELO ratings for match result prediction in association football. International Journal of Forecasting, 26(3), 460–470. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.ijforecast.2009.10.002")}.
pitstop_data_elo_example <- tibble::tibble(
Pos. = 1:11,
Team = c("Team_3","Team_1","Team_1","Team_1","Team_1",
"Team_2","Team_1","Team_3","Team_3","Team_2","Team_3"),
Driver = rep("Driver", 11),
"Time (sec)" = c(2.18, 2.21, 2.24, 3, 4, 4.04, 4.07, 4.08, 7.88, 8.88, 14.54),
Lap = 1:11,
Points = rep(0, 11),
Round = rep(0, 11),
Year = rep(2026, 11))
pitelo(pitstop_data_elo_example)
pitelo(pitstop_data_elo_example, stat_fun = 2)
pitelo(pitstop_data_elo_example, stat_fun = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.