This repository contains the data and code used in a manuscript "A Comprehensive Survey of the Home Advantage in American football" by Luke Benz, Thompson Bliss and Michael Lopez. (Link, Pre-print)
- data/final/NFL_games.csv: Includes info on season, teams, travel distance and scores for each Regular Season/Postseason NFL game 2004-2023 Regular Season.
NOTE: Data was pulled internally from NFL database so no R file is included to pull data.
- data/final/NCAA_games.csv: Includes info on season, teams, travel distance and scores for each NCAA game from 2004-2023 seasons.
- code/data/get_NCAA_data.R: Script to pull NCAA games data from MasseyRatings.
- final/hs_games_SEASON.csv:: Folder containing all data used for this project. Each of the 17 leagues has its own folder, containing 5 csv files of game level statistics for games played that year. SEASON spans from 2004 to 2023.
- code/data/get_hs_data.R: Script to pull high school games data from Max Preps. Calls scripts from code/data/high_school_helper.
- code/data/test_various_game_cutoffs_HS.R: Script to test various cut-offs for minimum number of games/seasons for a high school team to be included in analysis.
- code/model/run_model.R Script to iteratively fit the three models for each state.
- code/model/stan/model_MODELNUM.stan: Stan code for respective model. MODELNUM spans from 1 to 3.
- code/model/stan/model_2_hierarchical.stan: Stan code for hierarchical version of model_2.
- code/results_analysis/loo_compare.R Script to compute expected log pointwise predictive density (ELPD) estimated via the leave-one-out cross-validation.
- code/results_analysis/visualize_results.R: Script to visualize model results.
- code/results_analysis/team_strength_check.R: Script to compare team strength results from MasseyRatings to our ratings.
- code/results_analysis/model_diagnostics.R: Script to check model diagnostics.
- code/results_analysis/compare_models_2.R: Script to compare standard and hierarchical versions of Model 2
Note the rstan
package is required to work with model objects and/or run the modeling scripts. For assistance installing Stan, please refer to the official documentation.