Skip to contents

All teams are ranked (if possible) by their contribution to the difference in score in (qualifying) matches of the First Robotics Compettition. These rankings are generally based on matches from the qualifying round and provide teams with more information to pick other teams when they form alliances.

Usage

get_ranking_by_diff(data, ..., method = "normal")

Arguments

data

tibble of match information - it is assumed that each line corresponds to the score breakdown of one team in one event's match.

...

numeric variables measuring aspects a team's performance (in qualifying matches).

method

character which model should be calculated? Either normal or loglinear.

Value

tibble of the ranked teams and the number of matches (n) that the ranking is based on.

Details

In order to model each team's contribution to the score difference, a wide data set has to be constructed, with each team as a variable, and each row as one of the alliances in one match with the difference in score as the dependent variable. An alliance in a match consists of exactly three robots. This requirement is checked before modelling and if not fulfilled, results in a warning. A normal model is then fitted, or, if method = "loglinear" a log-linear model is fitted, if all values in the scoring variable are non-negative. The coefficients of this model can be interpreted as the average (log) contribution of that team to the difference in score of a match. Based on this information, an expected score difference can be calculated for an alliance.

Examples

# example code
# get all matches for one event:
matches <- get_records("event/2024cttd/matches")
# get the score breakdown for each of the teams in each match
match_details <- get_match_details(matches)

library(dplyr, quietly=TRUE)
# now get the contribution to the score:
match_details %>% filter(comp_level == "qm") %>% # get the qualifying matches
  get_ranking_by_diff(score)
#> # A tibble: 41 × 3
#>    team_key     n `rating_diff(score)`
#>    <chr>    <int>                <dbl>
#>  1 frc3284      8                35.8 
#>  2 frc5801      8                17.4 
#>  3 frc5126      8                16.8 
#>  4 frc3928      8                15.3 
#>  5 frc1108      8                11.3 
#>  6 frc1769      8                 9.23
#>  7 frc1987      8                 9.16
#>  8 frc1730      8                 6.54
#>  9 frc5968      8                 4.97
#> 10 frc5098      8                 2.60
#> # ℹ 31 more rows

# additionally get the team contributions to the score without counting the opponents' fouls:
match_details %>% filter(comp_level == "qm") %>% 
  get_ranking_by_diff(score, score-foulPoints)
#> # A tibble: 41 × 4
#>    team_key     n `rating_diff(score)` `rating_diff(score - foulPoints)`
#>    <chr>    <int>                <dbl>                             <dbl>
#>  1 frc3284      8                35.8                              9.11 
#>  2 frc5801      8                17.4                             -3.86 
#>  3 frc5126      8                16.8                             -8.23 
#>  4 frc3928      8                15.3                             -4.33 
#>  5 frc1108      8                11.3                             -1.14 
#>  6 frc1769      8                 9.23                           -15.9  
#>  7 frc1987      8                 9.16                            -0.239
#>  8 frc1730      8                 6.54                           -11.3  
#>  9 frc5968      8                 4.97                           -17.6  
#> 10 frc5098      8                 2.60                           -17.6  
#> # ℹ 31 more rows