Lab1 NFL ELO Ratings

About ELO Ratings

Elo is a dynamic rating system that works to identify player/team strength temporally. At a high level, every team enters every game with an Elo rating. This rating is just a number (usually between 1000 to 2000), with a higher number representing a stronger team.1 In short, Elo is based on head-to-head match ups based on the strength of each team. Elo rating can generally be applied in two separate contexts: the performance of each team for the latest season or the performance of each team for all games ever played throughout league history. We will focus on the latest NFL season because there is so much turnover from year to year in the NFL, that interpreting ability becomes difficult. 2

#\ label: Load-data
#\ include: False
#\ message: False 
nfl_games_22 <- read.csv('https://raw.githubusercontent.com/gc521/DATA-607-Data-Acquisition-Mangement/Lab-1/nfl_elo_latest.csv')
glimpse(nfl_games_22)
Rows: 283
Columns: 33
$ date           <chr> "2022-09-08", "2022-09-11", "2022-09-11", "2022-09-11",…
$ season         <int> 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2022, 2…
$ neutral        <int> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
$ playoff        <chr> "", "", "", "", "", "", "", "", "", "", "", "", "", "",…
$ team1          <chr> "LAR", "ATL", "CHI", "CIN", "MIA", "DET", "WSH", "CAR",…
$ team2          <chr> "BUF", "NO", "SF", "PIT", "NE", "PHI", "JAX", "CLE", "B…
$ elo1_pre       <dbl> 1614.761, 1436.672, 1444.508, 1558.193, 1539.979, 1406.…
$ elo2_pre       <dbl> 1614.247, 1543.815, 1576.152, 1510.144, 1537.003, 1502.…
$ elo_prob1      <dbl> 0.5931814, 0.4396466, 0.4052512, 0.6571832, 0.5965966, …
$ elo_prob2      <dbl> 0.4068186, 0.5603534, 0.5947488, 0.3428168, 0.4034034, …
$ elo1_post      <dbl> 1576.965, 1430.691, 1472.753, 1538.985, 1560.633, 1393.…
$ elo2_post      <dbl> 1652.043, 1549.795, 1547.907, 1529.352, 1516.349, 1514.…
$ qbelo1_pre     <dbl> 1582.712, 1379.245, 1412.480, 1550.251, 1518.381, 1412.…
$ qbelo2_pre     <dbl> 1613.253, 1516.085, 1563.009, 1473.261, 1513.693, 1532.…
$ qb1            <chr> "Matthew Stafford", "Marcus Mariota", "Justin Fields", …
$ qb2            <chr> "Josh Allen", "Jameis Winston", "Trey Lance", "Mitch Tr…
$ qb1_value_pre  <dbl> 200.2837, 111.5325, 111.2384, 173.6501, 139.1765, 155.5…
$ qb2_value_pre  <dbl> 259.60634, 151.06923, 119.82546, 168.27807, 143.53664, …
$ qb1_adj        <dbl> 5.93870786, -12.43573941, -2.07240038, 3.74275134, -0.5…
$ qb2_adj        <dbl> 9.1447503, 3.3059740, -7.6746208, 3.3467565, 0.1490076,…
$ qbelo_prob1    <dbl> 0.5341452, 0.3570171, 0.3748913, 0.6751554, 0.5821228, …
$ qbelo_prob2    <dbl> 0.4658548, 0.6429829, 0.6251087, 0.3248446, 0.4178772, …
$ qb1_game_value <dbl> -47.50244, 314.39130, 40.61001, 23.31953, 179.56180, 11…
$ qb2_game_value <dbl> 402.14942, 151.83253, 19.89750, 111.57543, 122.14855, 2…
$ qb1_value_post <dbl> 175.50508, 131.81835, 104.17553, 158.61707, 143.21500, …
$ qb2_value_post <dbl> 273.86064, 151.14556, 109.83266, 162.60781, 141.39783, …
$ qbelo1_post    <dbl> 1549.330, 1374.515, 1442.478, 1530.384, 1539.874, 1401.…
$ qbelo2_post    <dbl> 1646.635, 1520.815, 1533.011, 1493.128, 1492.200, 1543.…
$ score1         <int> 10, 26, 19, 20, 20, 35, 28, 24, 9, 20, 23, 21, 20, 24, …
$ score2         <int> 31, 27, 10, 23, 7, 38, 22, 26, 24, 20, 7, 44, 21, 19, 1…
$ quality        <int> 91, 19, 37, 56, 56, 33, 18, 10, 34, 21, 79, 72, 36, 59,…
$ importance     <int> 59, 54, 59, 75, 85, 64, 41, 48, 51, 51, 93, 64, 50, 79,…
$ total_rating   <int> 75, 37, 48, 66, 71, 49, 30, 29, 43, 36, 86, 68, 43, 69,…
#Filter for a glimpse at NFL teams prior to week 1
nflgames22.week1 <- nfl_games_22 %>% filter(date == "2022-09-11")
nflgames22.week1.Thurs <- nfl_games_22 %>% filter(date == "2022-09-08")
nflgames22.week1.Mon <- nfl_games_22 %>% filter(date == "2022-09-12")
nflgames22.week1 <- rbind(nflgames22.week1, nflgames22.week1.Mon, nflgames22.week1.Thurs) 

Examing ELO Ratings: Before and Throughout 2022 Season.

Lets look at the pre ELO ratings for each team to get a better understanding of where each teams stands at the beginning of the season based on their ELO rating.

nflgames22.week1 <- nflgames22.week1 %>% rename(Home = team1)
nflgames22.week1 <- nflgames22.week1 %>% rename(Away = team2)
nflgames22.week1 <- nflgames22.week1 %>% rename(eloHome = elo1_pre)
nflgames22.week1 <- nflgames22.week1 %>% rename(eloAway = elo2_pre)

g <- ggplot(nflgames22.week1, aes(Home, eloHome))
g + geom_point(aes(colour = factor(Home), size = eloHome)) +
geom_label_repel(aes(label = Home))


p <- ggplot(nflgames22.week1, aes(Away, eloAway))
p + geom_point(aes(colour = factor(Away), size = eloAway)) + geom_label_repel(aes(label = Away))

Elo ratings before 2022 season for Home Teams

Elo ratings before 2022 season for Away Teams

EloRatings before 2022 season for all NFL teams.

We can see that KC and the LAR had the highest ratings at the beginning of the season.

Next we can look at the Elo Ratings for each team thoougout the season to see how their ratings changed throughout the season.

nfl_games_22 <- nfl_games_22 %>% rename(Home = team1)
nfl_games_22 <- nfl_games_22 %>% rename(Away = team2)
nfl_games_22 <- nfl_games_22 %>% rename(eloHome = elo1_pre)
nfl_games_22 <- nfl_games_22 %>% rename(eloAway = elo2_pre)
nfl_games_22$date <- as.Date(nfl_games_22$date)


g <- ggplot(nfl_games_22, aes(x=date, y=eloHome, group=Home, color = Home)) 
g + geom_line(size=2, alpha=0.3, linetype=1) + geom_point() + theme_ipsum() +
geom_label_repel(aes(label = Home))


p <- ggplot(nfl_games_22, aes(x=date, y=eloAway, group=Away, color = Away)) 
p + geom_line(size=2, alpha=0.3, linetype=1) + geom_point() + theme_ipsum() +   geom_label_repel(aes(label = Away))

Elo ratings throughout 2022 season for Home Teams

Elo ratings throughout 2022 season for Away Teams

EloRatings throughout 2022 season for all NFL teams.

Discussion

The above visual shows that KC and BUF are were consistently once of the highest rated teams in regards to their ELO ratings, while HOU was the team with lowest ELO rating throughout the 2022 NFL season.

```

Footnotes

  1. https://www.thefantasyfootballers.com/articles/elo-you-how-this-rating-system-affects-fantasy-football/#:~:text=How%20does%20Elo%20work%3F,number%20representing%20a%20stronger%20team.↩︎

  2. https://projects.fivethirtyeight.com/complete-history-of-the-nfl/#lar↩︎