Modeling ESPN’s Total Quarterback Rating with Game-Level Data With Quantile and Stepwise Regression in R, Python, and Julia

Stepwise Regression
Quantile Regression
VS Code
R
Python
Julia
Guide to VS Code and R, Python, and Julia…
Authors
Affiliation

St. Lawrence University

Ivan Ramler

St. Lawrence University

Published

April 22, 2026

Please note that these material have not yet completed the required pedagogical and industry peer-reviews to become a published module on the SCORE Network. However, instructors are still welcome to use these materials if they are so inclined.

Welcome Video

If you are unfamiliar with ESPN’s Total Quarterback Rating (QBR), you can watch this video to learn more:

Introduction

The National Football League (NFL) has 14 official positions for players: 7 offensive, 5 defensive, and 2 special teams positions. One of the offensive positions is called Quarterback (QB), and their role is to lead their team on the field. ESPN streams NFL games and provides a lot of data on NFL players, including their Total Quarterback Rating (QBR), a 0-100 score measuring a quarterback’s contribution to winning. Higher scores indicate better performance.

In this module, you will learn how to model Total Quarterback Rating using only game-level data from the 2025 NFL Regular season. To predict QBR, we will use stepwise regression and you will have the choice of learning it in Julia, R, or Python. After using stepwise, we will use quantile regression to see for which quantile of quarterbacks we can most accurately predict QBR given the best model we found with stepwise regression.

By the end of this tutorial, you will be able to:

  1. Perform stepwise regression in Julia, R, or Python.

  2. Perform quantile regression in Julia, R, or Python.

  3. Understand how to interpret the results of stepwise and quantile regression.

This could be suitable of an out of class activity or one that spans one or more class periods.

Technology Requirement:

This activity is designed to be completed in Julia, R, or Python using Google Colab, RStudio, or VS Code.

No previous experience with regression is required, but some familiarity with one of the programming languages is recommended.

Data

The nfl_qbr.csv dataset contains 540 rows, each row representing a game from the 2025 NFL Regular season with 65 unique quarterbacks.

Download Data: nfl_qbr.csv

Variable Descriptions
Variable Description
week Week of the NFL Regular Season
player Full name of the quarterback for this game
qbr ESPN Total Quarterback Rating (0-100) for the quarterback in this game
team NFL team the quarterback played for this game
opponent_team NFL team the quarterback played against this game
completions Number of passes the quarterback completed this game
attempts Number of passes the quarterback attempted this game
passing_yards Total yards gained through the quarterback’s passing in this game
passing_tds Number of touchdown passes thrown by the quarterback in this game
passing_interceptions Number of passes by the quarterback that were intercepted
sacks Number of times the quarterback was tackled behind the line of scrimmage this game
fumbles Number of times the quarterback lost possession of the football
prop_total Proportion of total points scored this game that were scored by the quarterback’s team
result The quarterback’s team score this game subtracted by the opposing team’s score
Data Source The data was all scraped from https://www.espn.com/nfl/ using the R package nflreadr. The uncleaned data included weekly Total QBR, player statistics, and game schedules for the 2025 NFL Regular season. After cleaning, the final dataset includes only quarterbacks and each row represents a game played in the regular season.

Pick a Programming Language

The module is available in Julia, R, or Python. You can switch between modules using the tabs below based on which programming language you would like to use for this module.

Here is a little bit about each language to help you make your decision:

ImportantWARNING

Do not install any of the languages yet using the links below if you do not already have them, there are downloading guides provided for each language within its respective tab further in the module.

Learn more about R: here

Learn more about Python: here

Learn more about Julia: here

Getting started in R

To start programming in R, I recommend downloading RStudio. To do so, you can follow this guide here: Guide to Installing R and RStudio.

If you already have another platform downloaded that you would like to use, that will also work, but there will be some language specific to the RStudio platform within this module.

install.packages("quantreg")
library(quantreg)

Using Quantile Regression

Getting started in Python

To start programming in Python, I recommend downloading Visual Studio Code (VS Code). To do so, you can follow this guide here: Guide to Installing Python and VS Code.

If you already have another platform downloaded that you would like to use, that will also work, but there will be some language specific to the VS Code platform within this module.

Package: statsmodels

Python code

Using Quantile Regression

Getting started in Julia

To start programming in Julia, I recommend downloading Visual Studio Code (VS Code). To do so, you can follow this guide here: Guide to Installing Julia and VS Code.

If you already have another platform downloaded that you would like to use, that will also work, but there will be some language specific to the VS Code platform within this module.

Package: QuantReg.jl

Julia code

Using Quantile Regression

References

Ho T, Carl S (2026). nflreadr: Download ‘nflverse’ Data. R package version 1.5.0.9002, https://nflreadr.nflverse.com.

Thumbnail photo from https://simpsonstappedout.fandom.com/wiki/Football_Nelson