{xengagement} is a package that predicts the amount of Twitter
engagement that xGPhilosophy
receives with its end-of-match xG summary tweets. The predictions are
shared with automated tweets made by a
bot, occasionally including some
manually inserted commentary 😀.
Read this Twitter thread for a high-level discussion of how the package can be used to gain insights. Also, see this dashboard using outputs from this package. (Yes, that is a python-based web app :snake: using outputs from an R package :laughing:.)
You can install the development version of {xengagement} from
GitHub with:
# install.packages('remotes')
remotes::install_github('tonyelhabr/xengagement')-
data-raw/update.R: Run the Twitter bot. -
data-raw/98_train.R: Re-train models. -
data-raw/99_evaluate.R: Update plots used in Twitter thread. -
data-raw/00_scrape_colors.R: Re-scrape team colors. The results have to be added manually to theteam_mapping.csvfile. (Not using{teamcolors}package since it may or may not be kept up-to-date.) -
data-raw/01_generate_team_mapping.R: Update internal team mapping data sets, presumably when there are changes to EPL teams (e.g. at the beginning of a new season). Also, update team account Twitter followers (which isn’t done withtransform_tweets()to prevent hitting the Twitter API a ton).
-
Convert estimated follower counts for teams to percent ranks. (My guess is that this would slightly improve model performance.)
-
Do a true time-based cross validation to get a better esimtate of future predictive performance.
-
Make bot tweets more custom.