I develop and explore an expected points model at the play level for evaluating college football offenses and defenses. The goal of this analysis is to place a value on offensive/defensive plays in terms of their contribution’s to a team’s expected points.
The data comes from collegefootballdata.com, which has play by play data on games from 2000 to present. Each observation represents one play in a game, in which we know the team, the situation (down, time remaining), and the location on the field (yards to go, yards to reach end zone). We have information about the types of plays as well in a text field.
Note
Due to data quality issues, I focus my analysis on the years from 2007 and onwards.
1.1 Sequences of Play
For each play in a game, I model the probability of the next scoring event that will occur within the same half for either team. This means the analysis is not at the drive level, but at what I dub the sequence level. For any given play, the next scoring event can take on one of seven outcomes:
Touchdown (7 points)
Field goal (3 points)
Safety (2 points)
No Score (0 points)
Opponent safety (-2 points)
Opponent field goal (-3 points)
Opponent touchdown (-7 points)
Suppose we have two teams, A and B, playing in a game. Team A receives the opening kickoff, begins drive #1, drives for a few plays, and then punts. Team B takes over, which starts drive #2, and they drive for a few plays before also punting. Team A then manages to finally put points on the board, scoring a TD on drive #3.
All plays on these three drives are one sequence. The outcome of this sequence is the points scored by Team A - if they score a touchdown, their points from this sequence is 7 (assuming for now they make the extra point). Team B’s points from this sequence is -7 points.
This means that each one of these play was leading up to the Next Scoring Event of Team A scoring, which was the outcome we assign to each drive (and play) in that sequence.
Show the code
tibble(offense =c("A", "B", "A"),defense =c("B", "A", "B"),sequence =c(1, 1, 1),drive =c(1, 2, 3),drive_result =c("PUNT", "PUNT", "TD"),score_result =c(NA, NA, "OFFENSE TD"),next_score_event =c("team A TD", "team A TD", "team A TD")) |>gt_tbl()
offense
defense
sequence
drive
drive_result
score_result
next_score_event
A
B
1
1
PUNT
—
team A TD
B
A
1
2
PUNT
—
team A TD
A
B
1
3
TD
OFFENSE TD
team A TD
If the team on offense drives down and scores a TD/FG, this will end the sequence. If the team on offense does not score but punts or turns the ball over, the sequence will continue with the other team now on offense. The sequence will continue until either one team scores, or the half comes to an end. From this, a sequence begins at kickoff and ends at the next kick off. When Team A kicks off to Team B to start drive #4, we start our next sequence, which will end either with one team scoring or at the end of the half.
Why model the outcome of sequences rather than individual drives? Individual plays have the potential to affect both team’s chances of scoring, positively or negatively, and we want our model to directly capture this. If an offense turns the ball over at midfield, they are not only hurting their own chances of scoring, they are increasing the other team’s chance of scoring. The value of a play in terms of expected points is function of how both team’s probabilities are affected by the result of the play.
1.2 Defining Expected Points
A team’s expected points is sum of the probability of each possible scoring event multiplied by the points of that event. For this analysis, I assume that touchdowns equate to 7 rather than 6 points, assuming that extra points will be made. I can later bake in the actual probability of making extra points, but this will be a simplification for now.
For a given play \(i\) for Team \(A\) facing Team \(B\), we can compute Team A’s expected points using the following:
How do we get the probabilities of each scoring event? We learn these from historical data by using a model - I train a multinomial logistic regression model on many seasons worth of college football plays to learn how situations on the field affect the probability of the next scoring event.
1.3 Next Scoring Event
The outcome for our analysis is the next scoring event. Each play in a given sequence contributes to the eventual outcome of the sequence. Here we can see an example of one game and its drives:
For this game, we can filter to the plays that took place in the lead up to first score event. In this case, the first sequence included one drive and ended when Texas A&M kicked a field goal.
Show the code
# function to display plays in a drivedrive_plays_tbl <-function(data) { data |>select(season, game_id, offense, defense, drive_number, down, distance, yards_to_goal, play_text, next_score_event_offense) |>group_by(season, game_id, drive_number) |>gt_tbl() |> gt::cols_label(next_score_event_offense ="next_score_event") |> gt::cols_align(columns =c("offense", "defense", "down", "distance", "yards_to_goal"), align ="center")}# show first driveprepared_pbp |>inner_join(sample_games) |>filter(drive_number ==1) |>drive_plays_tbl()
offense
defense
down
distance
yards_to_goal
play_text
next_score_event
2012 - 322520245 - 1
Texas A&M
Florida
1
10
75
TEXAS A&M penalty 5 yard False Start on Patrick Lewis accepted.
FG
Texas A&M
Florida
1
15
80
Christine Michael rush for no gain to the TexAM 20.
FG
Texas A&M
Florida
2
15
80
Johnny Manziel pass complete to Ryan Swope for a loss of 2 yards to the TexAM 18.
FG
Texas A&M
Florida
3
17
82
Johnny Manziel rush for 16 yards to the 50 yard line, FLORIDA penalty 16 yard Personal Foul accepted for a 1ST down.
FG
Texas A&M
Florida
1
10
50
Johnny Manziel pass complete to Kenric McNeal for 8 yards to the Fla 42.
FG
Texas A&M
Florida
2
2
42
Christine Michael rush for 2 yards to the Fla 40 for a 1ST down.
FG
Texas A&M
Florida
1
10
40
Johnny Manziel pass complete to Kenric McNeal for 3 yards to the Fla 37.
FG
Texas A&M
Florida
2
7
37
Christine Michael rush for 6 yards to the Fla 31.
FG
Texas A&M
Florida
3
1
31
Christine Michael rush for no gain to the Fla 31.
FG
Texas A&M
Florida
4
1
31
Johnny Manziel pass complete to Nehemiah Hicks for 8 yards to the Fla 23 for a 1ST down.
FG
Texas A&M
Florida
1
10
23
Johnny Manziel pass complete to Ryan Swope for 2 yards to the Fla 21.
FG
Texas A&M
Florida
2
8
21
Johnny Manziel pass complete to Christine Michael for 14 yards to the Fla 7 for a 1ST down.
FG
Texas A&M
Florida
1
7
7
Johnny Manziel pass incomplete to Kenric McNeal, broken up by Matt Elam.
FG
Texas A&M
Florida
2
7
7
Johnny Manziel pass incomplete to Mike Evans, broken up by Marcus Roberson.
FG
Texas A&M
Florida
3
7
7
Johnny Manziel rush for 3 yards to the Fla 9, TEXAS A&M penalty 5 yard Illegal Forward Pass on Johnny Manziel accepted.
FG
Texas A&M
Florida
4
9
9
Taylor Bertolet 27 yard field goal GOOD.
FG
If we look at another sequence in the second half, we can see there were multiple drives before a team was able to score in that sequence.
Note
The next scoring event is always defined from the perspective of the offense.
Christine Michael rush for 6 yards to the TexAM 33.
Opp_TD
Texas A&M
Florida
2
4
67
Christine Michael rush for 1 yard to the TexAM 34.
Opp_TD
Texas A&M
Florida
3
3
66
Johnny Manziel pass complete to Mike Evans for 1 yard to the TexAM 35.
Opp_TD
Texas A&M
Florida
4
2
65
Ryan Epperson punt for 42 yards, fair catch by Andre Debose at the Fla 23.
Opp_TD
2012 - 322520245 - 10
Florida
Texas A&M
1
10
77
Jeff Driskel pass complete to Frankie Hammond for 10 yards to the Fla 33 for a 1ST down.
TD
Florida
Texas A&M
1
10
67
Mike Gillislee rush for 4 yards to the Fla 37.
TD
Florida
Texas A&M
2
6
63
Jeff Driskel pass complete to Omarius Hines for 7 yards to the Fla 44 for a 1ST down.
TD
Florida
Texas A&M
1
10
56
Mike Gillislee rush for 3 yards to the Fla 47.
TD
Florida
Texas A&M
2
7
53
Jeff Driskel sacked by Spencer Nealy for a loss of 1 yard to the Fla 46.
TD
Florida
Texas A&M
3
8
54
Jeff Driskel sacked by Sean Porter and Damontre Moore for a loss of 12 yards to the Fla 34.
TD
Florida
Texas A&M
4
20
66
Kyle Christy punt for 48 yards, fair catch by Dustin Harris at the TexAM 18.
TD
2012 - 322520245 - 11
Texas A&M
Florida
1
10
82
Johnny Manziel pass complete to Mike Evans for a loss of 2 yards to the TexAM 16.
Opp_TD
Texas A&M
Florida
2
12
84
Trey Williams rush for a loss of 2 yards to the TexAM 14.
Opp_TD
Texas A&M
Florida
3
14
86
Johnny Manziel rush for 3 yards to the TexAM 17.
Opp_TD
Texas A&M
Florida
4
11
83
Ryan Epperson punt for 53 yards, downed at the Fla 30.
Opp_TD
2012 - 322520245 - 12
Florida
Texas A&M
1
10
70
Jeff Driskel pass complete to Jordan Reed for 5 yards to the Fla 35.
TD
Florida
Texas A&M
2
5
65
Mack Brown rush for no gain to the Fla 35.
TD
Florida
Texas A&M
3
5
65
Jeff Driskel rush for 14 yards to the Fla 49 for a 1ST down.
TD
Florida
Texas A&M
1
10
51
Matt Jones rush for 5 yards to the TexAM 46.
TD
Florida
Texas A&M
2
5
46
Jeff Driskel pass incomplete.
TD
Florida
Texas A&M
3
5
46
Jeff Driskel rush for no gain to the TexAM 46.
TD
Florida
Texas A&M
4
5
46
Kyle Christy punt for 37 yards, fair catch by Dustin Harris at the TexAM 9.
TD
2012 - 322520245 - 13
Texas A&M
Florida
1
10
91
Johnny Manziel pass complete to Mike Evans for 14 yards to the TexAM 23 for a 1ST down.
Opp_TD
Texas A&M
Florida
1
10
77
TEXAS A&M penalty 11 yard Personal Foul on Kenric McNeal accepted.
Opp_TD
Texas A&M
Florida
1
10
88
Johnny Manziel pass complete to Thomas Johnson for 2 yards to the TexAM 14.
Opp_TD
Texas A&M
Florida
2
8
86
Johnny Manziel pass complete to Mike Evans for 5 yards to the TexAM 19.
Opp_TD
Texas A&M
Florida
3
3
81
Johnny Manziel sacked by Lerentee McCray for a loss of 4 yards to the TexAM 15.
Opp_TD
Texas A&M
Florida
4
7
85
Ryan Epperson punt for 47 yards, fair catch by Andre Debose at the Fla 38.
Opp_TD
2012 - 322520245 - 14
Florida
Texas A&M
1
10
62
Mike Gillislee rush for 5 yards to the Fla 43.
TD
Florida
Texas A&M
2
5
57
Jeff Driskel pass complete to Omarius Hines for 39 yards to the TexAM 18 for a 1ST down.
TD
Florida
Texas A&M
1
10
18
Solomon Patton rush for 6 yards to the TexAM 12.
TD
Florida
Texas A&M
2
4
12
Mike Gillislee rush for 12 yards for a TOUCHDOWN.
TD
1.4 Illustrating Expected Points
Our goal is to understand how individual plays contribute to a team’s expected points, or the average points a team should expect to score on average given their situation (down, time, possession).
For instance, in the first drive of the Texas A&M-Florida game in 2012, Texas A&M received the ball at their own 25 yard line to open the game.
The simplest intuition of expected points is to ask, for teams starting at the 25 yard line at the beginning of a game, how many points do they typically go on to score?
One way to answer this is to look at all starting drives with 75 yards to go and see what the eventual next scoring event was for each of these plays - we simply take the average of all of the points that followed from teams in this situation.
In this case, we find teams with the ball at their own 25 to start the game generally obtained more points on the ensuing sequence than their opponents, so they have a slightly positive expected points.
But, expected points is also a function of the down. If we look at the expected points for a team in this situation in first down vs a team in this situation for fourth down, we should see a drop in their expected points - by the time you hit fourth down, if you haven’t moved from the 25, your expected points drops into the negatives, as you will now be punting the ball back to your opponent and it becomes more probable that they score than you.
The fact that expected points changes based on the situation (down, yard line, time remaining) allows us to calculate the difference in expected points from play to play. That is, before the ball is snapped, we ask, what is the expected points given the current situation?
Then the ball is hiked and the play occurs; what is the expected points now? Did it increase or decrease? This difference in expected points from play to play, positive or negative, is what we refer to as Expected Points Added.
For any given play, we get a sense of the expected points a team can expect from their situation. For instance, if we look at all total plays in a game, how do expected points vary as a function of a team’s distance from their opponent’s goal line?
This should make sense - if you’re backed up against your own end zone, your opponent has higher expected points because they are, historically, more likely to have the next scoring event - either by gaining good field advantage after you punt or by getting a safety. We can see this if we just look at the proportion of next scoring events based on the offense’s position on the field.
From this, when we see an offense move the ball up the field on a given play, we will generally see their expected points go up. The difference in expected points before the snap and after the snap is the value added (positively or negatively) by the play.
But, it’s not just position on the field - it’s also about the situation. If we look at how expected points varies by the down, we should see that fourth downs have lower expected points.
And we also have info on time remaining in the half - as we might expect, the proportion of drives leading to no scoring goes up as the amount of time remaining in the half goes down.
Show the code
prepared_pbp |>filter(yard_line <100& yard_line >0) |>group_by(seconds_in_half =round_any(seconds_in_half, 5), next_score_event_offense ) |>count() |>ggplot(aes(x = seconds_in_half, y = n, fill = next_score_event_offense)) +geom_col(position ="fill") +scale_fill_viridis_d() +ylab("proportion")+scale_x_reverse()
We use all of this historical data to learn the expected points from a given situation, then look at the difference in expected points from play to play - this is the intuition behind how we will value individual plays, which we can then roll up to the offense/defense/game/season level.
2 Modeling Expected Points
How do these various features like down, distance, yards to goal, and time remaining affect the probability of the next scoring event? I use a model to learn this relationship from historical plays.
First, I set up training, validation, and test sets based around the season. I rely on data from the 2007 season onwards, as the data quality of plays starts to get worse the further back we go, though I can later do some backtesting of the model on older seasons.
Show the code
# load in pieces from modeltar_load(split_pbp)tar_load(pbp_last_fit)# get wflowpbp_fit = pbp_last_fit |>extract_workflow()# show plansplit_pbp |>plot_split_plan()
The outcome of interest is next_score_event, which is always defined from the perspective of the offense.
I train a multinomial logistic regression on the next scoring event for each play (TD, FG, Opp. TD, Opp. FG, etc) as a function of the situation in the game (down, distance, yards to goal). I use the probabilities from this model to compute expected points at the play level, which I then aggregate to the team, game, and season level in order to measure each team’s raw offensive/defensive efficiency.
I examine the model’s performance on the validation set.
What I really care about is the calibration of the predictions - does the observed incidence rate of events match the predicted probabilities from the model? That is, when the model predicts that the next scoring event has a probability of 0.5 of being a TD, do we observe TDs occur about half of the time?
Show the code
pbp_last_fit |>collect_predictions() |>plot_pbp_calibration() +labs(title ="Model Calibration",subtitle = stringr::str_wrap("Observed vs predicted incident rate of next scoring event from classification model", 90) )
Understanding partial effects from a multinomial logit is difficult, and I’ve thrown a bunch of interactions in there to make this even more unwieldy. I’ll extract the coefficients and take a look (excluding the intercept), but really in order to interpret this model I’ll use predicted probabilities.
I’ll look at predicted probabilities using an observed values approach for particular features (using a sample rather than the full dataset to save time). This amounts taking historical plays and setting features to specific values for every observation, predicting those observations with the model, then finding the average predicted probability as the feature changes.
The following visualization the predicted probability of each scoring event based on field position.
Show the code
set.seed(1999)samp <- split_pbp |>training() |>slice_sample(n =10000)v <-expand.grid(yards_to_goal =seq(0, 99, 3),down =c(1, 2, 3, 4))df <-map(seq(0, 99, 2),~ { samp |>mutate(yards_to_goal := .x) |>nest(data =-yards_to_goal) } ) |>list_rbind() |>unnest(data)est <- df |>estimate_pbp_effect(fit = pbp_fit) |>summarize_pbp_effect(vars ="yards_to_goal")est |>pivot_pbp() |>mutate(class =factor_class(class)) |>ggplot(aes(x = yards_to_goal, color = class,y = prob )) +geom_line() +scale_color_viridis_d() +facet_wrap(class ~ ., ncol =4) +coord_cartesian(ylim =c(0, 1)) +ylab("Pr(Outcome)") +xlab("Yards to Opponent End Zone") +labs(title ="Predicted Probability of Scoring Event by Offensive Field Position",subtitle = stringr::str_wrap("Predicted probabilities from classification model trained on historical play by play data. Displaying probabilities using observed values approach from a random sample of plays", 90) ) +guides(color ="none")
How is this affected by the down?
Show the code
df2 <-map(c(1, 2, 3, 4),~ { df |>mutate(down := .x) |>nest(data =-c(yards_to_goal, down)) } ) |>list_rbind()est2 <- df2 |>unnest(data) |>estimate_pbp_effect(fit = pbp_fit) |>summarize_pbp_effect(vars =c("yards_to_goal", "down"))# plot probabilitiesest2 |>pivot_pbp() |>mutate(down =factor(down),class =factor_class(class) ) |>ggplot(aes(x = yards_to_goal,color = down,y = prob )) +geom_line() +scale_color_viridis_d() +facet_wrap(class ~ ., ncol =4) +coord_cartesian(ylim =c(0, 1)) +ylab("Pr(Outcome)") +xlab("Yards to Goal") +labs(title ="Predicted Probability of Scoring Event by Offensive Field Position and Down",subtitle = stringr::str_wrap("Predicted probabilities from classification model trained on historical play by play data. Displaying probabilities using observed values approach from a random sample of plays", 90) )
We can then translate these predicted probabilities into expected points, multiplying the predicted probabilities for each scoring event by their point value.
Show the code
est2 |>mutate(down =factor(down)) |>calculate_expected_points() |>ggplot(aes(x = yards_to_goal, y = expected_points, color = down)) +geom_line() +scale_color_viridis_d() +coord_cartesian(ylim =c(-3, 7)) +geom_hline(yintercept =0, linetype ="dashed") +labs(title ="Expected Points by Offensive Field Position and Down",subtitle = stringr::str_wrap("Expected points using probabilities from classification model trained on historical play by play data. Displaying expected points using observed values approach from a random sample of plays", 90) )
3 Predicted Points Added
With the model in hand, I can predict the probability of the next scoring event for every play in order to compute the expected points within each game situation. The difference in expected points from play to play is the currency by which we can evaluate players/teams/offenses/defenses.
3.1 Examining a Drive
Going back to the game between Texas A&M and Florida in 2012 as an example (chosen entirely at random and not at all because it was the final home game of my last year at A&M), we can examine the first drive in terms of expected points.
TEXAS A&M penalty 5 yard False Start on Patrick Lewis accepted.
0.622
-0.209
-0.831
Texas A&M
Florida
80
1
15
Christine Michael rush for no gain to the TexAM 20.
-0.209
-1.144
-0.935
Texas A&M
Florida
80
2
15
Johnny Manziel pass complete to Ryan Swope for a loss of 2 yards to the TexAM 18.
-1.144
-2.401
-1.257
Texas A&M
Florida
82
3
17
Johnny Manziel rush for 16 yards to the 50 yard line, FLORIDA penalty 16 yard Personal Foul accepted for a 1ST down.
-2.401
2.615
5.016
Texas A&M
Florida
50
1
10
Johnny Manziel pass complete to Kenric McNeal for 8 yards to the Fla 42.
2.615
3.434
0.820
Texas A&M
Florida
42
2
2
Christine Michael rush for 2 yards to the Fla 40 for a 1ST down.
3.434
3.265
-0.169
Texas A&M
Florida
40
1
10
Johnny Manziel pass complete to Kenric McNeal for 3 yards to the Fla 37.
3.265
2.973
-0.292
Texas A&M
Florida
37
2
7
Christine Michael rush for 6 yards to the Fla 31.
2.973
3.462
0.489
Texas A&M
Florida
31
3
1
Christine Michael rush for no gain to the Fla 31.
3.462
1.436
-2.026
Texas A&M
Florida
31
4
1
Johnny Manziel pass complete to Nehemiah Hicks for 8 yards to the Fla 23 for a 1ST down.
1.436
4.183
2.747
Texas A&M
Florida
23
1
10
Johnny Manziel pass complete to Ryan Swope for 2 yards to the Fla 21.
4.183
3.796
-0.387
Texas A&M
Florida
21
2
8
Johnny Manziel pass complete to Christine Michael for 14 yards to the Fla 7 for a 1ST down.
3.796
4.973
1.177
Texas A&M
Florida
7
1
7
Johnny Manziel pass incomplete to Kenric McNeal, broken up by Matt Elam.
4.973
4.382
-0.591
Texas A&M
Florida
7
2
7
Johnny Manziel pass incomplete to Mike Evans, broken up by Marcus Roberson.
4.382
3.526
-0.855
Texas A&M
Florida
7
3
7
Johnny Manziel rush for 3 yards to the Fla 9, TEXAS A&M penalty 5 yard Illegal Forward Pass on Johnny Manziel accepted.
3.526
2.283
-1.244
Texas A&M
Florida
9
4
9
Taylor Bertolet 27 yard field goal GOOD.
2.283
—
0.717
In this case, we can see how the results of plays added or lost points in expectation.
The play with the most points added was Manziel’s rush for 16 yards on 3 and 17 combined with a personal foul on Florida for an additional 15 yards. A long third down inside your own territory is a negative points situation for an offense; teams in this situation usually have to punt, which leads to the other teams being more likely to score with favorable field position. Converting on a long third down and moving to midfield results in a big change in the expected points you would get from the drive.
An example of a negative points play is the previous play, with Manziel’s pass to Swope for 2 yards on 2nd and 15. Even though this play gained yardage, the end result left them with a 3rd and long in their own territory.
Note
The result of this drive was a field goal, where the expected points added (~0.75) equals the actual points (3) minus the expected points from the situation (~2.25).
However the metric Expected Points Added typically doesn’t include scoring plays. In analyzing an offense, I’ve seen others working with these types of model make a theoretical distinction between plays that add points vs plays that only result in a shift in the expected points of situation.
Predicted Points Added uses both scoring plays and non scoring plays, taking into account both expected points and actual points added as a result of the play.
3.2 Examining Games
Once we’ve scored plays, we can examine individual games to examine which plays had the biggest impact in terms of expected points. Here I’ll examine a few games, chosen completely at random and in no way influenced by my fandom.
3.2.1 Texas A&M - Alabama 2012
Kind of interesting - this game is remembered for a lot of plays by Johnny Manziel, but the most impactful plays in the game in terms of expected points changes were actually turnovers forced by the A&M defense.
AJ McCarron pass complete to Amari Cooper for 54 yards for a TOUCHDOWN.
0.929
—
6.071
Alabama
Texas A&M
4
38
1
10
T.J. Yeldon rush for 8 yards to the TexAM 30, fumbled, forced by Steven Terrell, recovered by TexAM Dustin Harris, Dustin Harris for 4 yards to the TexAM 34.
3.472
-1.462
-4.935
Alabama
Texas A&M
1
52
3
5
AJ McCarron pass intercepted by Sean Porter at the TexAM 43, returned for 16 yards to the Alab 41.
1.242
-3.365
-4.606
Texas A&M
Alabama
4
68
3
8
Johnny Manziel pass complete to Ryan Swope for 28 yards to the Alab 25, ALABAMA penalty 15 yard Personal Foul on Ha'Sean Clinton-Dix accepted for a 1ST down.
-0.157
4.393
4.550
Alabama
Texas A&M
4
88
1
18
AJ McCarron pass complete to Amari Cooper for 50 yards to the TexAM 38 for a 1ST down.
-0.660
3.472
4.133
Texas A&M
Alabama
1
10
3
10
Johnny Manziel pass complete to Ryan Swope for 10 yards for a TOUCHDOWN.
3.296
—
3.704
Texas A&M
Alabama
1
59
3
6
Johnny Manziel rush for 32 yards to the Alab 27 for a 1ST down.
0.718
4.288
3.570
Alabama
Texas A&M
2
2
3
2
Eddie Lacy rush for 2 yards for a TOUCHDOWN.
3.714
—
3.286
Alabama
Texas A&M
4
60
1
10
AJ McCarron pass complete to Kenny Bell for 54 yards to the TexAM 6 for a 1ST down.
1.178
4.437
3.259
Texas A&M
Alabama
4
24
1
10
Johnny Manziel pass complete to Malcome Kennedy for 24 yards for a TOUCHDOWN.