5.8 Value of a home run

Batting average gives equal value to the four possible base hits.

home_runs |>
  select(state) |>
  table()
## state
## 000 0 000 1 000 2 001 0 001 1 001 2 010 0 010 1 010 2 011 0 011 1 011 2 100 0 
##  1530   957   845    12    39    61    98   150   158    24    37    39   319 
## 100 1 100 2 101 0 101 1 101 2 110 0 110 1 110 2 111 0 111 1 111 2 
##   357   340    28    74    63    82   131   156    18    44    48

hr_statevals <- home_runs |>
  select(state) |>
  table() |>
  prop.table() |>
  round(3)
hr_statevals
## state
## 000 0 000 1 000 2 001 0 001 1 001 2 010 0 010 1 010 2 011 0 011 1 011 2 100 0 
## 0.273 0.171 0.151 0.002 0.007 0.011 0.017 0.027 0.028 0.004 0.007 0.007 0.057 
## 100 1 100 2 101 0 101 1 101 2 110 0 110 1 110 2 111 0 111 1 111 2 
## 0.064 0.061 0.005 0.013 0.011 0.015 0.023 0.028 0.003 0.008 0.009

Assess by bases:

##   000   001   010   011   100   101   110   111 
## 0.595 0.020 0.072 0.018 0.182 0.029 0.066 0.020

Over half of the home runs are hit with no runners on base

What is the run value of a home run?

mean_hr <- home_runs |>
  summarize(mean_run_value = mean(run_value))
mean_hr
## # A tibble: 1 × 1
##   mean_run_value
##            <dbl>
## 1           1.38
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Most home runs occur with bases empty (1)

Which runner/out situations lead to the most valuable home runs?

home_runs |> 
  arrange(desc(run_value)) |>
  select(state, new_state, run_value) |>
  slice_head(n = 1)
## # A tibble: 1 × 3
##   state new_state run_value
##   <chr> <chr>         <dbl>
## 1 111 2 000 2          3.41

Bases loaded, 2 outs