Are NFL Teams Exceedingly Mediocre This Year?

October 20, 2017 at 11 PM

On a recent podcast, Bill Simmons wondered aloud if the NFL as a whole is especially mediocre this year. I haven’t been watching all that much NFL football this season, but from what I have seen this observation rings true—the teams do seem pretty bad.

Fortunately, the question are NFL teams exceptionally mediocre this year? is pretty easy to answer precisely thanks to football-reference.com. First, I pulled week-by-week results for nine recent seasons,1 being mindful to be a good citizen and download the data very slowly:

wget -w 3 https://www.pro-football-reference.com/years/2016/week_{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}.htm

Then, I parsed out the weekly winners and losers using rvest and purrr:

# Team name is the last word
. %>% str_split(" ") %>% `[[`(1) %>% tail(1) -> get_team_name

# Extract teams
. %>%
  html_text() %>%
  Filter(function(.x) .x != "Final", .) %>%
  map_df(~ tibble(team = get_team_name(.x))) -> extract_teams

get_winners_losers <- function(html_document, week) {
  doc <- read_html(html_document)

  bind_rows(
    html_nodes(doc, "tr.winner td a") %>%
      extract_teams() %>%
      mutate(week = week, win = 1, loss = 0),
    html_nodes(doc, "tr.loser td a") %>%
      extract_teams() %>%
      mutate(week = week, win = 0, loss = 1))
}

# 2008 wk 9 is bad
years <- setdiff(2007:2017, 2008)

won_loss_df <- map_df(years, ~ {
  year <- .x
  message(paste("Year", year))

  map_df(1:17, ~ {
    week <- .x
    message(paste("Week", week))

    path <- paste0("./pages/", year, "/week_", week, ".htm.xz")
    if (!file.exists(path)) {
      message(paste0("File does not exist: ", path))
    } else {
      paste0("./pages/", year, "/week_", week, ".htm.xz") %>%
        get_winners_losers(week) %>%
        mutate(year = year)
    }
  })
})

The resulting data frame, won_loss_df, marks whether teams won, lost, or had a bye. From this point it isn’t hard to aggregate the results and take a look at historical results through Week Six, and I was a bit surprised by the following figure:

2017 is the most mediocre season in the sample! (Even though it seemed possible, I wasn’t really expecting the data to back me up.) But…2017 doesn’t take the crown by all that much. The 2017 season brings 12 teams with three wins after Week Six, but the 2012 season had 11 teams and 2013 had 10. It just feels anomalous—maybe because so many other teams have 2 or 4 wins.2

So, by this simple metric the NFL isn’t extraordinarily mediocre this season—just ho-hum mediocre.

Congratulations.


  1. One week’s data was missing for the 2008 season, so that year was omitted. ↩︎

  2. The 2017 season has the smallest standard deviation around the mean number of wins (sd = 1.17 wins), with the 2012 season the runner up (1.30). ↩︎

Related Posts