I want to find the kicker who is both consistent (the ball crosses at or near the center of the goalposts) and clutch (keeps making kicks in high-pressure moments).
A kick counts as clutch when either of these is true:
Score within 3 points 4th quarter / overtime Last 2 min of the 1st half Wind 15+ mph 32°F or colder 90°F or hotter Rain or snow (outdoors)
I build the kick data straight from the raw Big Data Bowl files. From
plays.csv I keep every field goal and extra point. From the
tracking files I follow the football after the kick and find where it
crosses the goalpost plane, which gives the sideways offset from the
center of the uprights. This report reads the CSV files from the
nfl-big-data-bowl-2022 folder.
pkgs <- c("data.table", "ggplot2", "plotly", "kableExtra", "stringr",
"dplyr", "tidyr", "htmltools", "htmlwidgets")
new <- pkgs[!pkgs %in% installed.packages()[, "Package"]]
if (length(new)) install.packages(new)
invisible(lapply(pkgs, library, character.only = TRUE))
# ---- Build kick table straight from the raw tracking files ----------
# The first run takes a few minutes; it then saves kicks_from_tracking.csv
# so later runs (and knitting) are fast. Delete that file to rebuild.
GOAL_X <- 110 # back line of the end zone = goalpost plane
CENTER_Y <- 53.3 / 2 # middle of the field = goalpost center
need <- c("plays.csv", "players.csv", "games.csv",
"tracking2018.csv", "tracking2019.csv", "tracking2020.csv")
miss <- need[!file.exists(need)]
if (length(miss) && !file.exists("kicks_from_tracking.csv"))
stop("Can't find: ", paste(miss, collapse = ", "),
"\nCurrent folder is: ", getwd())
plays <- fread("plays.csv")
players <- fread("players.csv")
games <- fread("games.csv")
if (file.exists("kicks_from_tracking.csv")) {
kicks <- fread("kicks_from_tracking.csv")
} else {
fg <- plays[specialTeamsPlayType %in% c("Field Goal", "Extra Point") &
specialTeamsResult %in% c("Kick Attempt Good", "Kick Attempt No Good")]
fg[, `:=`(made = as.integer(specialTeamsResult == "Kick Attempt Good"),
is_xp = as.integer(specialTeamsPlayType == "Extra Point"))]
ball <- rbindlist(lapply(c("tracking2018.csv", "tracking2019.csv", "tracking2020.csv"),
function(f) {
message("Reading ", f, " ...")
tr <- fread(f, select = c("gameId", "playId", "frameId", "x", "y",
"event", "team", "playDirection"))
tr <- tr[team == "football"]
tr[fg[, .(gameId, playId)], on = c("gameId", "playId"), nomatch = 0]
}))
# Flip so every kick travels toward x = 120
ball[playDirection == "left", `:=`(x = 120 - x, y = 53.3 - y)]
setorder(ball, gameId, playId, frameId)
# Lateral offset where the ball crosses the goalpost plane
cross <- ball[, {
kf <- frameId[grepl("field_goal|extra_point|kick", event)][1]
if (is.na(kf)) kf <- frameId[event == "ball_snap"][1]
if (is.na(kf)) kf <- frameId[1]
xx <- x[frameId >= kf]; yy <- y[frameId >= kf]
i <- which(xx >= GOAL_X)[1]
ext <- 0L
if (!is.na(i) && i > 1) {
yc <- yy[i - 1] + (GOAL_X - xx[i - 1]) * (yy[i] - yy[i - 1]) / (xx[i] - xx[i - 1])
} else if (length(xx) >= 2 && isTRUE(diff(tail(xx, 2)) > 0)) {
n <- length(xx) # tracking stopped early: extend the last direction
yc <- yy[n] + (GOAL_X - xx[n]) * (yy[n] - yy[n - 1]) / (xx[n] - xx[n - 1])
ext <- 1L
} else yc <- NA_real_
.(e = yc - CENTER_Y, e_extrapolated = ext)
}, by = .(gameId, playId)]
kicks <- merge(fg, cross, by = c("gameId", "playId"))
kicks <- merge(kicks, players[, .(kickerId = nflId, kicker = displayName)],
by = "kickerId", all.x = TRUE)
kicks[, D := kickLength]
kicks[is.na(D), D := 110 - absoluteYardlineNumber + 8] # fallback
kicks <- kicks[!is.na(e) & abs(e) < 15] # drop bad tracks
# Weather is not in the raw files; add it if kick_model_data.csv is here
wx <- c("indoor", "crosswind", "tailwind", "temp", "rain", "snow")
if (file.exists("kick_model_data.csv")) {
km <- fread("kick_model_data.csv", select = c("gameId", "playId", wx))
kicks <- merge(kicks, km, by = c("gameId", "playId"), all.x = TRUE)
} else kicks[, (wx) := NA_real_]
kicks <- kicks[, .(gameId, playId, quarter, kickerId, kicker, made, is_xp,
D, e, e_extrapolated, indoor, crosswind, tailwind,
temp, rain, snow)]
fwrite(kicks, "kicks_from_tracking.csv")
}
kicks <- as.data.frame(kicks)
# Shared look for every chart
green <- "#0b6e3b"
theme_kick <- function() {
theme_minimal(base_size = 13) +
theme(plot.title = element_text(face = "bold", color = "#064e2b", hjust = 0.5),
strip.text = element_text(face = "bold", color = "#064e2b"),
panel.grid.minor = element_blank())
}
pff <- fread("PFFScoutingData.csv")
merged_df <- plays %>%
left_join(players, by = c("kickerId" = "nflId")) %>%
left_join(games, by = "gameId") %>%
left_join(pff, by = c("gameId", "playId"))
nrow(merged_df) # should equal the number of rows in plays (19,979)
## [1] 19979
table(plays$specialTeamsPlayType)
##
## Extra Point Field Goal Kickoff Punt
## 3488 2657 7843 5991
table(plays$specialTeamsResult)
##
## Blocked Kick Attempt Blocked Punt Downed
## 61 39 834
## Fair Catch Kick Attempt Good Kick Attempt No Good
## 1645 5470 585
## Kickoff Team Recovery Muffed Non-Special Teams Result
## 16 214 101
## Out of Bounds Return Touchback
## 651 5207 5156
I chose to look at field goals because … (explain your reason here).
kicker_summary <- merged_df %>%
filter(specialTeamsPlayType == "Field Goal",
specialTeamsResult %in% c("Kick Attempt Good", "Kick Attempt No Good",
"Blocked Kick Attempt")) %>%
group_by(displayName, possessionTeam) %>%
summarise(attempts = n(),
made = sum(specialTeamsResult == "Kick Attempt Good"),
make_pct = round(100 * made / attempts, 1),
seasons = n_distinct(season),
.groups = "drop") %>%
filter(seasons > 1) %>%
arrange(-make_pct)
head(kicker_summary, 10)
## # A tibble: 10 × 6
## displayName possessionTeam attempts made make_pct seasons
## <chr> <chr> <int> <int> <dbl> <int>
## 1 Josh Lambo JAX 57 54 94.7 3
## 2 Justin Tucker BAL 94 87 92.6 3
## 3 Younghoe Koo ATL 57 52 91.2 2
## 4 Jason Myers SEA 44 40 90.9 2
## 5 Harrison Butker KC 85 77 90.6 3
## 6 Nick Folk NE 42 38 90.5 2
## 7 Wil Lutz NO 86 77 89.5 3
## 8 Mason Crosby GB 71 63 88.7 3
## 9 Aldrick Rosas NYG 44 39 88.6 2
## 10 Chris Boswell PIT 63 55 87.3 3
clock_secs <- function(clk) {
p <- str_split_fixed(as.character(clk), ":", 3)
s <- as.numeric(p[, 1]) * 60 + as.numeric(p[, 2])
ifelse(is.na(s), 900, s)
}
# season comes from games.csv (it is not in the kick table)
kicks <- kicks[, setdiff(names(kicks), "season"), drop = FALSE]
kicks <- kicks |>
left_join(as.data.frame(games)[, c("gameId", "season")], by = "gameId") |>
left_join(as.data.frame(plays) |>
select(gameId, playId, preSnapHomeScore, preSnapVisitorScore, gameClock),
by = c("gameId", "playId")) |>
mutate(
score_diff = abs(preSnapHomeScore - preSnapVisitorScore),
clock_sec = clock_secs(gameClock),
close_late = score_diff <= 3 & (quarter >= 4 | (quarter == 2 & clock_sec <= 120)),
bad_weather = coalesce(indoor == 0 & (abs(crosswind) >= 15 | abs(tailwind) >= 15 |
temp <= 32 | temp >= 90 | rain == 1 | snow == 1), FALSE),
clutch = coalesce(close_late, FALSE) | bad_weather,
position = case_when(e < -3.083 ~ "Outside - left of post",
e > 3.083 ~ "Outside - right of post",
TRUE ~ "Between Posts"),
clean_date = paste(str_sub(gameId, 5, 6), str_sub(gameId, 7, 8),
str_sub(gameId, 1, 4), sep = "-")
)
Clutch score = clutch make rate minus normal make rate. Consistency = 1 ÷ (average distance from center + spread). Both are standardized and added into a composite. Kickers need 25+ kicks and 5+ clutch kicks.
rank_df <- kicks |>
filter(!is.na(kicker)) |>
group_by(kicker) |>
summarise(total_kicks = n(), clutch_kicks = sum(clutch),
clutch_pct = mean(made[clutch]), normal_pct = mean(made[!clutch]),
avg_offset = mean(abs(e), na.rm = TRUE), spread = sd(e, na.rm = TRUE),
.groups = "drop") |>
filter(total_kicks >= 25, clutch_kicks >= 5) |>
mutate(z_clutch = as.numeric(scale(clutch_pct - normal_pct)),
z_consistency = as.numeric(scale(1 / (avg_offset + spread))),
composite = z_clutch + z_consistency) |>
arrange(desc(composite))
top3 <- head(rank_df$kicker, 3)
rank_df |>
head(10) |>
mutate(Number = row_number(), .before = 1,
clutch_pct = 100 * clutch_pct, normal_pct = 100 * normal_pct) |>
select(Number, kicker, total_kicks, clutch_kicks, clutch_pct, normal_pct, avg_offset, composite) |>
kable(format = "html", digits = 2,
col.names = c("#", "Kicker", "Kicks", "Clutch Kicks", "Clutch %",
"Normal %", "Avg Offset (yds)", "Composite"),
caption = "Top 10 Kickers: Clutch + Consistency (2018-2020)") |>
kable_styling(bootstrap_options = c("striped", "hover", "condensed"),
full_width = FALSE, position = "center") |>
row_spec(1:3, bold = TRUE)
| # | Kicker | Kicks | Clutch Kicks | Clutch % | Normal % | Avg Offset (yds) | Composite |
|---|---|---|---|---|---|---|---|
| 1 | Wil Lutz | 230 | 32 | 100.00 | 95.45 | 0.89 | 3.77 |
| 2 | Rodrigo Blankenship | 80 | 8 | 100.00 | 90.28 | 1.05 | 2.94 |
| 3 | Ryan Succop | 159 | 30 | 93.33 | 90.70 | 0.95 | 2.68 |
| 4 | Mason Crosby | 201 | 62 | 96.77 | 91.37 | 1.04 | 2.43 |
| 5 | Justin Tucker | 228 | 64 | 96.88 | 96.34 | 0.97 | 2.38 |
| 6 | Sebastian Janikowski | 71 | 24 | 100.00 | 85.11 | 1.17 | 2.35 |
| 7 | Chris Boswell | 169 | 32 | 93.75 | 91.97 | 1.05 | 1.76 |
| 8 | Josh Lambo | 105 | 27 | 100.00 | 92.31 | 1.15 | 1.67 |
| 9 | Nick Folk | 82 | 19 | 94.74 | 92.06 | 1.09 | 1.61 |
| 10 | Mike Nugent | 44 | 9 | 100.00 | 91.43 | 1.24 | 1.56 |
ggplot(kicks |> filter(kicker %in% top3), aes(x = e, y = D)) +
stat_density_2d(aes(fill = after_stat(level)), geom = "polygon", alpha = 0.6) +
geom_point(aes(color = factor(made, levels = c(0, 1), labels = c("Missed", "Made"))),
size = 1.4, alpha = 0.75) +
geom_vline(xintercept = c(-3.083, 3.083), color = "goldenrod", linewidth = 1.2) +
geom_vline(xintercept = 0, linetype = "dashed") +
facet_wrap(~kicker) +
scale_fill_viridis_c() +
scale_color_manual(values = c(Missed = "#c0392b", Made = green)) +
labs(title = "Where the Ball Crossed the Goal Line: Top 3 Kickers",
x = "Offset from Center (yds, + = right)", y = "Kick Distance (yds)",
color = "Result", fill = "Density") +
theme_kick()
head(rank_df, 10) |>
select(kicker, z_clutch, z_consistency) |>
pivot_longer(-kicker, names_to = "part", values_to = "z") |>
ggplot(aes(x = reorder(kicker, z, sum), y = z, fill = part)) +
geom_col(width = 0.75) + coord_flip() +
scale_fill_manual(values = c(z_clutch = "#064e2b", z_consistency = "#d4a72c"),
labels = c("Clutch", "Consistency")) +
labs(title = "Top 10 Kickers: Clutch + Consistency Composite",
x = NULL, y = "Composite Score (z)", fill = NULL) +
theme_kick()
Use the season boxes to filter. Hover over any dot for the date, distance and kicker.
cl <- kicks |> filter(clutch) |> mutate(season = factor(season))
g <- ggplot(cl, aes(x = e, y = 0, color = position,
group = interaction(season, position), customdata = season,
text = paste0("Date: ", clean_date, "<br>Season: ", season,
"<br>Distance: ", D, " yds<br>Kicker: ", kicker,
"<br>Offset: ", round(e, 2), " yds"))) +
geom_point(size = 3, alpha = 0.7, position = position_jitter(height = 0.1)) +
geom_vline(xintercept = c(-3.083, 3.083), linetype = "dashed", linewidth = 1) +
scale_color_manual(values = c("Between Posts" = green,
"Outside - left of post" = "#c0392b",
"Outside - right of post" = "#e67e22")) +
labs(title = "Clutch Kicks: Ball Position at the Goal Line",
x = "Offset from Center (yds)", y = NULL, color = "Position") +
theme_kick() +
theme(axis.text.y = element_blank(), axis.ticks.y = element_blank())
p <- ggplotly(g, tooltip = "text", width = 900, height = 500)
p <- onRender(p, "
function(el, x) {
var orig = JSON.parse(JSON.stringify(el.data));
function f() {
var sel = [];
document.querySelectorAll('.season-checkbox:checked').forEach(function(b){ sel.push(b.value); });
el.data.forEach(function(t, i) {
var o = orig[i];
if (!o.customdata) return;
var nx=[], ny=[], nt=[], nc=[];
for (var j = 0; j < o.x.length; j++) {
if (sel.includes(String(o.customdata[j]))) {
nx.push(o.x[j]); ny.push(o.y[j]); nc.push(o.customdata[j]);
if (o.text) nt.push(o.text[j]);
}
}
Plotly.restyle(el, {x:[nx], y:[ny], text:[nt], customdata:[nc]}, [i]);
});
}
document.querySelectorAll('.season-checkbox').forEach(function(b){ b.addEventListener('change', f); });
}")
box <- function(yr) tags$label(tags$input(type = "checkbox", class = "season-checkbox",
value = yr, checked = "checked"), paste0(" ", yr, " "))
div(style = "width: 900px; max-width: 100%; margin: auto;",
div(style = "text-align: center;",
div(class = "season-box",
tags$strong("Select Season: "), box("2018"), box("2019"), box("2020"))),
p)
The top three kickers are Wil Lutz, Rodrigo Blankenship, Ryan Succop. They keep their make rate up in clutch moments and their kicks cross the goal line close to the center.