26/08/2018

NFL Analysis

The weathers getting cooler and the leaves are beginning to turn - it can only mean the NFL season is coming around and time for a bit of preseason analysis. As anyone will be unsuprised to here, Quaterbacks are the highest paid NFL position with 76% of the top NFL contracts, based on average yearly salary, belonging to those in the Quaterback position [1]. Indeed 2018 is lining up to be no different, with 80% of the top NFL contracts still belonging to Quaterbacks [2].

But are they worth it? And does a high salary ensure we see a Quaterback with high passing yards?

Here I explore how the 2017 Quaterbacks stack up against each other and whether salary can predict passing yards.

Data

Data were obtained direct (via webscraping) from the official NFL website at NFL.com, where details on the game stats (Pass yards, Rushing yards, Fumbles, Touchdowns etc) can be found for each individual player. We'll be webscraping from the above site to gain the 2017 statistics from the 71 Quaterbacks who played in the 2017 Main Season (excluding Pre and Post season games). We also wanted to obtain Salary inforamtion (average salary) for each of the Quaterbacks which was manually entered from data supplied by Sportrac.com [3].

Data example

Player Team Yds YdsperG Salary
32 Aaron Rodgers GB 1675 239.3 22000.000
59 AJ McCarron CIN 66 22.0 600.413
8 Alex Smith KC 4042 269.5 17000.000
17 Andy Dalton CIN 3320 207.5 16000.000
5 Ben Roethlisberger PIT 4251 283.4 21850.000

Salary vs Total Yards

Figure 1: Linear regression between Salary and Total passing yards. R code found in Appendix

Salary vs Total Yards

Here, we can of course see a strong positive relationsip between Average Salary and Total passing yards suggesting the most well payed quaterbacks are performing well, atleast in terms of passing. There do appear to be some quaterbacks that don't fit with this relationship however, as those highlighted on the previous graph show. On the next few slides we'll go through each of these 3 quaterback groups to understand the outperformers and weak links from the 2017 season.

Outperformers

Those that are payed relativly low for a quaterback position , yet still show passing yards to rival the best of them (Red).

Despite some of these players already becoming household names, most are still fresh faced to the NFL with only a few years experience, and therefore remain on their first lower-salary contracts. Particually good value for the Phillidephia Eagles who, with 2nd year Carson Wentz's help, won Superbowl LII.

Poor or Unlucky?

We now look at the other side of the coin to quaterbacks who, in 2017, were payed higher than average for their total passing yard performance.

Aaron Rodgers: One of the most famous current NFL quaterbacks who unfortunatly didn't have a good year in 2017 with 1675 total passing yards - around average for the 2017 season but poor compared to fellow QB on a comparible salary. However, we can also see he gave us an above average passing yards per game of 239.3 (Figure 2: Green area), suggesting a good but short overall season. Indeed, Rodgers had his season cut short through injury.

Carson Palmer: Similar to Rodgers, Palmer is another great QB that unfortunatly shows a poor season due to injury, only played 7 games, and resulting in a relativly poor passing yards total of 1978, yet shows a above-average passing yards per game of 282.6 (Figure 2: Red area).

Poor or Unlucky?

Mike Glennon: Having just moved to the Chicago for the 2017 season, the Bears has high hopes for their new signing. Glennon only managed a 4 game season however, with 833 total yards, putting him way under the overall season average and average for his salary. Despite such a poor performance, this average yards per game seems pretty spot on given his salary at 208.2 yards per game (Figure 2: Pink area). Possibly if he'd been given more games, he'd manage to make it out of this danger zone. Despite this,and possible due to poor performance in other areas, he was released the following year.

Sam Bradford: Only playing 2 games this season, Bradford appears to be another unlucky quaterback with 382 total yards with an average of 191 per game. However this was below his salary expectation on both accounts suggesting that, although he only played a short season, he didn't perform well in either game. (Figure 2: Blue area)

Salary vs Yards per game

Figure 2: Linear regression between Salary and Passing yards per game. R code in Appendix

Figure 2: Linear regression between Salary and Passing yards per game. R code in Appendix

Summary

Here we show a strong positive relationship between passing yards and salary, with higher payed players exhibiting more passing yards. Of course this could be due to higher payed players (who are often veterns) having more game-time to rack up the yards compared to rookies on lower salaries, however this relationship still exists when we examine Salary against yards per game.
Interestingly the analysis showed that, while Mike Glennon had a low overall Total passing yards, he dispayed a yards per game average that was average for the Quaterbacks of the 2017 season - despite this be was still benched early in the season and let go at the end of it.
We can also see a number of rising stars within the Rookie and Early career Quaterbacks including Jared Goff, Carson Wentz and Dak Prescott who have shown exceedingly high passing yards compared to what their salary predicts.

Plot 1 - Code 1

# Perform a linear regression
fit <- lm(quaterbacks$Yds ~ quaterbacks$Salary)

plot_ly() %>%
  # Add the regression line
  add_trace(data=quaterbacks, y=fitted(fit),hoverinfo="none",
            x=quaterbacks$Salary, mode='scatter') %>%

Plot 1 - Code 2

  # Add 3 rectangles to highlight those not fitting the regression
  layout(xaxis = list(title = 'Average Year Salary (1000$)'),
         yaxis = list(title = 'Total Yards'),
         shapes =  list(
           list(type = "rect",fillcolor = "green", 
                    line = list(color = "green"), opacity = 0.3,
                    x0 = 14600, x1 = 18900, xref = "x",
                    y0 = 280, y1 = 1000, yref = "y"),
           list(type = "rect",fillcolor = "red", 
                    line = list(color = "red"), opacity = 0.3,
                    x0 = 0, x1 = 8000, xref = "x",
                    y0 = 2700, y1 = 4000, yref = "y"),
            list(type = "rect",fillcolor = "pink", 
                    line = list(color = "pink"), opacity = 0.3,
                    x0 = 21000, x1 = 25000, xref = "x",
                    y0 = 1500, y1 = 2100, yref = "y"))) %>%

Plot 1 - Code 3

  # Add the markers as a scatter plot
  add_markers(x= quaterbacks$Salary, 
              y= quaterbacks$Yds, 
              showlegend = FALSE, 
              color = I("black"), 
              text = ~paste(quaterbacks$Player), hoverinfo = 'text')

Plot 2 - Code

q <- ggplot(quaterbacks, aes(x=Salary, y=YdsperG))
q + geom_point(stat = "identity")+ 
  theme(axis.text.x = element_text(angle = 0, hjust = 1))+ 
  xlab("Average Year Salary (1000$)") + 
  ylab("Average Passing Yards (per game)") +
  geom_smooth(method='lm', se=TRUE)+
  geom_rect(aes(xmin = 21500,xmax = 22500,
                ymin = 232, ymax = 245),fill = 'green2',color = 'green',alpha = .002)+
  geom_rect(aes(xmin = 24100,xmax = 24600,
                ymin = 278, ymax = 286),fill = 'red2',color = 'red',alpha = .002)+
  geom_rect(aes(xmin = 14750,xmax = 15300,
                ymin = 200, ymax = 216),fill = 'maroon2',color = 'pink',alpha = .002)+
  geom_rect(aes(xmin = 17750,xmax = 18250,
                ymin = 185, ymax = 200),fill = 'blue2',color = 'blue',alpha = .002)

References