All functions

add_receiver_target_rates()

add_receiver_target_rates calculate how frequently receivers are targeted in entire dataset

add_throw_vector_to_positions()

add_throw_vector_to_positions takes player positions at release along with throw information to calculate how close the player is to the throw

aggregate_week_files()

aggregate_week_files aggregate all of the PBP data

build_final_leaderboard()

build_final_leaderboard The top-15 leaderboard in the final report

build_raw_stat_table()

build_raw_stat_table Get data on speed, acceleration to use in shiny app

build_target_prob_tune_results()

build_target_prob_tune_results function to create target prob tuning results from stored file

build_target_results()

build_target_results output all of the results of the target models to be used

build_weather_df()

build_weather_df returns a dataframe with parsed weather information for each gameId

catch_prob_diagnostic_plots()

catch_prob_diagnostic_plots make catch prob model diagnostic plots

connect_to_heroku_postgres()

connect_to_heroku_postgres

convert_secret()

convert_secret

create_throw_vectors()

create_throw_vectors returns a data frame with throw vectors

divvy_credit()

divvy_credit divvy credit between defenders

do_catch_prob_arrival_feat_eng()

do_catch_prob_arrival_feat_eng build a data frame of catch prob features

do_catch_prob_throw_feat_eng()

do_catch_prob_throw_feat_eng build a data frame of catch prob features

do_target_prob_feature_eng()

do_target_prob_feat_eng build a data frame of target prob features

fit_catch_prob_xgb()

fit_catch_prob_xgb fit the xgboost catch prob model

fit_logit_platt_scaler()

fit_logit_platt_scaler fit the Platt scaler to calibrate the xgboost predictions

fit_logit_target_platt_scaler()

fit_logit_target_platt_scaler fit the Platt scaler to calibrate the xgboost predictions

fit_prior_target_prob()

fit_prior_target_prob create an estimate of the likelihood a receiver is targeted before the play starts

fit_target_prob_rf()

fit_target_prob_rf fit the rf target prob model

fit_target_prob_xgb()

fit_target_prob_xgb fit the xgb target prob model

generate_man_zone_class()

full feature engineering and classification for man v zone coverages WARNING: this takes a lot of time to run

get_constants()

get_constants get project-wide constants

get_defense_locs_at_arrival()

get_defense_locs_at_arrival returns a data from of the locations of the defense at throw time

get_defense_locs_at_throw()

get_defense_locs_at_throw returns a data from of the locations of the defense at throw time

get_football_location_at_arrival() get_football_location_at_arrival()

get_football_location_at_arrival returns a data frame of the location of the football on each play

get_football_locations()

get_football_locations get a data frame of the location of the football on each play

get_heights()

get_heights returns a data frame of player heights

get_max_throw_velo()

get_max_throw_velo returns a data frame of maximum throw velos for each play

get_pi_and_sack()

get_pi_and_sack returns a data frame of pass interferences and sacks

get_play_outcomes()

get_play_outcomes returns a data frame of play outcomes

get_target_location_at_arrival()

get_target_location_at_arrival returns a data frame of the locations of the targeted receiver at throw time on each play

get_target_location_at_throw()

get_target_location_at_throw returns a data frame of the locations of the targeted receiver at throw time on each play

get_targeted_receiver()

get_targeted_receiver get a data frame of the targeted receiver on each play

get_throw_dists()

get_throw_dists returns a data frame of throw distances on each play

get_weather()

get_weather return the weather forecast in a given week

gt_theme_538()

gt_theme_538 the Fivethirtyeight GT theme Credit to Thomas Mock: https://themockup.blog/posts/2020-09-26-functions-and-themes-for-gt-tables/#fivethirtyeight

heroku_postgres_inserts()

heroku_postgres_inserts

load_encrypted()

load_encrypted

load_key_and_nonce()

load_key_and_nonce

load_player_summary_table()

load_player_summary_table Function that builds the overall results

make_catch_prob_table()

make_catch_prob_table makes the drops added table

make_tendency_table()

make_tendency_table makes the deterrence table

read_from_data()

read_from_data load data from csv file

read_individual_week()

read_individual_week load a single week of PBP data

read_non_week_files()

read_non_week_files read all of the non-PBP data

read_pff()

read_pff load PFF grades

recalc_prob()

recalc_prob recalculate the catch probabilities after removing a defender

run_catch_prob_tuning_pipeline()

run_catch_prob_tuning_pipeline runs the catch prob tuning pipeline

run_catch_prob_tuning_pipelines()

run_catch_prob_tuning_pipeline runs the catch prob tuning pipeline

run_target_prob_tuning_pipeline()

run_target_prob_tuning_pipeline pipeline for target prob model

save_encrypted()

save_encrypted

standardize_position_coordinates()

standardize_position_coordinates Takes raw position data and normalizes it so that drives only go one way and X coordinates are relative to goal line rather than back of end zone

stepwise_catch_prob_predict()

stepwise_catch_prob_predict Make calibrated predictions from xgboost + Platt scaling

stepwise_target_prob_predict()

stepwise_target_prob_predict Make calibrated predictions from rf + Platt scaling

stepwise_target_prob_predict_xgb()

stepwise_target_prob_predict Make calibrated predictions from rf + Platt scaling

target_prob_diagnostic_plots()

target_prob_diagnostic_plots same diagnostic plots for target probs

tune_catch_prob_xgb()

tune_catch_prob_xgb tune the xgboost catch prob model

tune_target_prob_rf()

tune_target_prob_rf tune the rf target prob model

tune_target_prob_xgb()

tune_target_prob_xgb tune the XGB target probability model TODO: actually document this rather than just copy paste