9.9 Compute Win Probabilities

Assume team talent is normally distributed

\[T \sim N(0, 0.2^{2})\]

set.seed(20250611)
s_talent <- 0.20
teams_68 <- teams_68 |>
  mutate(talent = rnorm(10, 0, s_talent))

# increase chances of Cardinals' and Tigers' success
teams_68$talent[teams_68$teamID == "DET"] <- 0.35
teams_68$talent[teams_68$teamID == "SLN"] <- 0.31

schedule_talent <- schedule |>
  inner_join(teams_68, join_by(lgID, Home == teamID)) |>
  rename(talent_home = talent) |>
  inner_join(teams_68, join_by(lgID, Visitor == teamID)) |>
  rename(talent_visitor = talent)

schedule_talent <- schedule_talent |> 
  mutate(
    prob_home = exp(talent_home) /
      (exp(talent_home) + exp(talent_visitor))
  )
Detroit Tigers 1968 Schedule
sample of 10 games
lgID Home Visitor talent_home talent_visitor prob_home
AL BAL DET −0.10 0.35 0.39
AL DET NYA 0.35 −0.02 0.59
AL DET MIN 0.35 −0.15 0.62
AL CLE DET 0.26 0.35 0.48
AL NYA DET −0.02 0.35 0.41
AL BAL DET −0.10 0.35 0.39
AL NYA DET −0.02 0.35 0.41
AL CLE DET 0.26 0.35 0.48
AL BOS DET −0.24 0.35 0.36
AL DET BAL 0.35 −0.10 0.61
table code
set.seed(20250611)
schedule_talent |>
  filter(Home == "DET" | Visitor == "DET") |>
  slice_sample(n = 10) |>
  gt() |>
  cols_align(align = "center") |>
  fmt_number(columns = c(talent_home, talent_visitor, prob_home),
             decimals = 2) |>
  tab_header(title = "Detroit Tigers 1968 Schedule",
             subtitle = "sample of 10 games") |>
  tab_style(
    locations = cells_body(columns = c(Home, prob_home), rows = Home == "DET" ),
    style = list(cell_fill(color = "#FA4616"), cell_text(color = "#0C2340"))) |>
  tab_style(
    locations = cells_body(columns = Visitor, rows = Visitor == "DET" ),
    style = list(cell_fill(color = "#FA4616"), cell_text(color = "#0C2340"))) |>
  tab_style(
    locations = cells_body(columns = c(Home, prob_home), rows = Home != "DET" ),
    style = list(cell_fill(color = "#0C2340"), cell_text(color = "#FA4616"))) |>
  tab_style(
    locations = cells_body(columns = Visitor, rows = Visitor != "DET" ),
    style = list(cell_fill(color = "#0C2340"), cell_text(color = "#FA4616")))