
Calculate the expected goals for all the shots in (a) play-by-plays
Source:R/Model.R
calculate_expected_goals.Rdcalculate_expected_goals() scores shot events with nhlscraper's built-in
ridge expected-goals model. The runtime model is a fixed six-partition system:
sd (5v5), ev (other even strength), pp (power play), sh
(short-handed), en (empty net against), and so (shootout / penalty
shot). The legacy model argument is accepted for backward compatibility but
ignored.
Arguments
- play_by_play
data.frame of play-by-play(s) using the current public schema returned by
gc_play_by_play(),gc_play_by_plays(),wsc_play_by_play(), orwsc_play_by_plays()- model
deprecated legacy model selector; ignored
Examples
# May take >5s, so skip.
# \donttest{
pbp <- gc_play_by_play()
pbp_with_xg <- calculate_expected_goals(play_by_play = pbp)
# }