15  Expected Score

library(tidyverse); theme_set(theme_bw())
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4.9000     ✔ readr     2.1.5     
✔ forcats   1.0.0          ✔ stringr   1.5.1     
✔ ggplot2   3.5.1          ✔ tibble    3.2.1     
✔ lubridate 1.9.3          ✔ tidyr     1.3.1     
✔ purrr     1.0.2          
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
source("../../R/construct_home_away_matrix.R")
source("../../R/make_teams.R")

15.1 Pairwise Probabilities

The starting point for developing approaches to modeling tournaments is a matrix containing probabilities for one team (or individual) beating another team (or individual). These probabilities can be calculated from margin of victory, win-loss, or win-tie-loss models and thus the matrices can be constructed using the probabilities.

Many tournaments are played on neutral courts and thus the home advantage term is generally not included. But if venues exist within the tournament that would provide home advantage, e.g. the court is actually the home court for a team or the court is located geographically close to a team, then the home advantage term could be computed.

For now, we will use the notation \(p_{A,B}\) to denote the probability that team A beats team B.

For example, in the 2024 NFL season, we can use the margin of victory model to compute the matrix for teams who qualified for the playoffs, i.e. the post-season tournament.

nfl2024_tmp <- read.csv("../../data/nfl.csv") |>
  filter(schedule_season == 2024,
         !schedule_playoff) |>
  mutate(
    margin = score_home - score_away
  ) |>
  rename(
    home = team_home,
    away = team_away
  )

teams <- make_teams(nfl2024_tmp)

nfl2024 <- nfl2024_tmp |>
  mutate(
    home = factor(home, levels = teams),
    away = factor(away, levels = teams)
  )

X <- construct_home_away_matrix(nfl2024)

m <- lm(nfl2024$margin ~ X)

# Calculate team strengths
strength <- coef(m)[-1] # move home advantage
strength[length(strength)] <- 

# Obtain playoff teams by name
playoff_teams <- teams |>
  filter(grepl("Chiefs|Bills|Ravens|Texans|Chargers|Steelers|Broncos|Packers|Commanders|Vikings|Rams|Buccaneers|Eagles|Lions", 
               names)) 

15.2