Takes in play by play data and drive info to estimate the value of each spot on the field. The model is built using a B-spline regression model predicting the number of points scored on the drives based on the current field position.
the "play.csv" data frame for the years to use to build the model
the "drive.csv" data frame
a named vector where the names are the yardlines on the field and the values are the estimated point values associated with that spot.
1 2 3 4
plays <- readin("play", 2014) drives <- readin("drive", 2014) epa_values <- expected_points_build(plays, drives) ## Not run: ggplot2::qplot(x = as.numeric(names(epa_values)), y = epa_values, xlab = "Distance From End Zone", ylab = "Expected Points", geom = "line", main = "Expected Points Model Results")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.