This repo contains my first-ever R Shiny project. It’s simple, and represents a minimally viable app. It’s super basic, but the app allows us to query and visualize the NHL’s Play-by-play event logs for a given game.
I updated the app for the
2015-16season. There are a few manual updates to the code that I could refactor and allow the end-user to set, but in the short run, it works.
The app also leverages a simple shot probability model that I built.
That repo can be found here.
Rhere for your OS.
install.packages('shiny')into the command line
This should fire up your default modern browser. It will take a few moments to load the data, and will refresh every 20 seconds or so. When you want to quit the app, go back to the terminal and type
CONTROL-C to kill the process.
Clearly this is very unpolished, but just a quick highlight of the dashboard app.
matcherrors on the MainPanel of the dashboard.
GETrequest to refresh the data or if there is a bug in
In my previous repo, I highlight a very proof-of-concept model. It’s not elegant, but very effective when estimating a player’s total season goals. With respect to the point estimates (actual probability of a shot going in), it has some room for improvement; AUC is mid .7’s.
The approach I use is simple: fit a logistic regression to predict a given shot going in goal given:
When applying the model to every shot from a player (identified by the NHL
playerid), and correlating the actual versus predicted goals over the course of a season, the
R-squared is a touch under
helpers.Rfor each season.