Playing around with NFL stats and win-probability models

accuracy.meas | Calculate classification accuracy statistics. |

best_kicking_option | Use the expected win probabilities to determine best kicking... |

breakeven | Calculates the breakeven point for making the decision. |

calc_prob_success | Use historical first down rates. When inside the opponent's... |

calculate_features | Generate features needed for the win probability model that... |

calculate_prob_poss | Determine the starting point for the final possession in each... |

calibration_plot | Produces a calibration plot for the win probability model. |

change_poss | Handles situation updating for all plays that involve a... |

code_fourth_downs | Parse all fourth downs and determine if teams intended to go... |

data_prep | Prepare Armchair Analysis data for analysis. |

dp_kneel_down | Code a situation a 1 if the offense can kneel to end the game... |

expected_win_prob | Expected value of win probability, factoring in p(success). |

expected_wp_fg | Expected WP from kicking, factoring in p(FG made). |

fg_model_train | Estimate field goal success probability model using Armchair... |

fg_success_rate | Historical field goal success rates by field position. |

first_down_rates | Find the mean 1st down success rate at a given point in the... |

generate_decision | Decide on optimal play based on game states and their... |

generate_response | Parent function called by the bot to make decisions on 4th... |

generate_win_probabilities | For each of the possible scenarios, estimate the win... |

get_historical_decision | Compare current game situation to historically similar... |

group_coaches_decisions | Group 4th down decisions by score difference and field... |

join_df_first_down_rates | Join the computed first down rates with the play by play... |

kneel_down | kneel_down |

load_data | Load previously compiled data and estimated win and field... |

load_games | Load data containing results of each game and return a... |

load_pbp | Load the play by play data and return a data frame. |

missed_field_goal | Opponent takes over from the spot of the kick. |

model_train | Estimate win probability model using Armchair Analysis... |

nyt_fg_model | Sub in simple logit for field goal success rates. |

plot_decision | Create a plot of the decision state to go for it, attempt a... |

plot_roc | ROC Plot |

punt | Use the average net punt distance (punt distance - return... |

punt_averages | Group punts by kicking field position to get average return... |

qtr | Given the seconds left in the game, determine the current... |

random_play | Generate a random play with plausible values for debugging... |

run_bot | Calculate the expected win probability for a given game... |

simulate_scenarios | Simulate game state after each possible outcome. Possible... |

switch_offense | Swap game state columns for offense & defense dependent... |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.