/nfl_elo_ratings

Data visualization project using NFL Elo Ratings provided by FiveThirtyEight

Primary LanguageRMIT LicenseMIT

Contributors Forks Stargazers Issues MIT License LinkedIn

NFL Elo Rating Visualization

This project sources Elo Ratings from FiveThirtyEight for National Football League teams and Quarterbacks and uses the R Shiny platform to provide a concise and useful user interface to help others explore the data.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Elo Ratings are a method for calculating the relative skill levels in a zero-sum game such as chess, or in this case, American football. This rating system was created by Arpad Elo, a Hungarian-American physics professor, and the creator of the system.

Elo ratings were originally developed for use in competitive chess, but has since been applied as a rating system in American football, baseball, basketball, billiards, table tennis, and many other competitive events such as e-sports. This particular implementation focuses on the National Football League (NFL) and Elo ratings of its member teams since the beginning of the Super Bowl Era, which began with the 1966 regular season.

Elo ratings are a zero-sum system, with the victorious team "winning" a number of points from the losing team after every game. No additional points are ever created or destroyed. The ratings of the teams prior to the game determine how many points are won by the victor and surrendered by the loser. A winner who had a higher rating entering the game will earn fewer points from a weak opponent than would a lower ranked winner which beat a team with a higher ranking. Elo ratings are also not considered an "absolute" metric of skill, meaning that they have no meaning outside the contained pool of teams and games (i.e., each season). Therefore, ratings between various years cannot necessarily be fairly compared.

The data used to develop this project is sourced from FiveThirtyEight and their excellent The Complete History Of The NFL project. The data contains the results of every NFL game played since the beginning of the 1966 regular season, and is current through Super Bowl LV (55), played in February of 2021 (2021 season data will be added when it is available on FiveThirtyEight's GitHub page).

(back to top)

Built With

  • R
  • Shiny

(back to top)

Getting Started

To generate your own copy of the Elo rating visualization tool, you'll need copies of the global.R, server.R and ui.R file from this repo, which can then be run using R Studio or any R-supported IDE.

Prerequisites

To work with the scripts required to run the Elo rating visualization tool, you will need to download R from the project website and R Studio (soon to be re-branded as Posit) from its project site as well. The links to each are provided below. R Studio is required because Shiny is a direct product of R Studio and the links between the global.R, server.R, and ui.R files are not inherently understood by the base R language.

  • R Statistical Programming Language

    https://www.r-project.org/
  • R Studio

    https://www.rstudio.com/products/rstudio/download/

Installation

  1. Clone the repo

    git clone https://github.com/JTGamber89/nfl_elo_ratings.git
  2. Create a local repo to run the files locally

  3. Open either ui.R or server.R and select the Run App button at the top-right of the IDE to start the visualization tool.

(back to top)

Variables

The data contained in the nfl_elo_SB_era.csv data file contains game-by-game Elo ratings and forecasts for all games in the Super Bowl Era, 1965 though the present. Some of the variable names in the data set can be confusing; please use the following table for the definitions of each column in the data.

Column Definition
date Date of game
season Year of season
neutral Whether game was on a neutral site
playoff Whether game was in playoffs, and the playoff round if so
team1 Abbreviation for home team
team2 Abbreviation for away team
elo1_pre Home team's Elo rating before the game
elo2_pre Away team's Elo rating before the game
elo_prob1 Home team's probability of winning according to Elo ratings
elo_prob2 Away team's probability of winning according to Elo ratings
elo1_post Home team's Elo rating after the game
elo2_post Away team's Elo rating after the game
qbelo1_pre Home team's quarterback-adjusted base rating before the game
qbelo2_pre Away team's quarterback-adjusted base rating before the game
qb1 Name of home starting quarterback
qb2 Name of away starting quarterback
qb1_value_pre Home starting quarterbacks's raw Elo value before the game
qb2_value_pre Away starting quarterbacks's raw Elo value before the game
qb1_adj Home starting quarterbacks's Elo adjustment for the game
qb2_adj Away starting quarterbacks's Elo adjustment for the game
qbelo_prob1 Home team's probability of winning according to quarterback-adjusted Elo
qbelo_prob2 Away team's probability of winning according to quarterback-adjusted Elo
qb1_game_value Home quarterback's Elo value during this game
qb2_game_value Away quarterback's Elo value during this game
qb1_value_post Home starting quarterbacks's raw Elo value after the game
qb2_value_post Away starting quarterbacks's raw Elo value after the game
qbelo1_post Home team's quarterback-adjusted base rating after the game
qbelo2_post Away team's quarterback-adjusted base rating after the game
score1 Home team's score
score2 Away team's score

(back to top)

Roadmap

  • Correct occurrences of games from consecutive weeks being displayed on a single week's column
  • Add "Explore Elo Ratings" Panel to allow users to test out how Elo ratings work interactively
  • Add separating lines between the end of one season and the beginning of the next in the "Career" panels

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star if you found it enjoyable! And thank you!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Project Link: https://github.com/JTGamber89/nfl_elo_ratings

(back to top)

Acknowledgments

I could not have begun this project without the teaching and encouragement from my professor, Dr. Joe Yurko at the University of Pittsburgh, and I would like to thank him for his time and attention during my graduate work and for inspiring my interest in sports data science.

(back to top)