If you are interested in the formula and math behind KOK Bot, keep reading. If not, just go ahead and try the KOK Bot.
I split up the formula into 4 parts: Yards to Go by Down, Field Position, Score Margin, and Time Left by Winning/Losing. For each part, I found the correlation between the situation and the percentage of times a pass play is called. For the ease the calculation, I assumed linear relationships for each part. (more yard to go -> more likely to pass; closer to end zone -> less likely to pass; winning by less/losing by more -> more likely to pass; and less time left when losing -> more likely to pass) So, for each situation, I found the “line of best fit” to calculate the chance of pass.
Example: for second down, the chance of passing = 0.0349*Yards to go + 0.497
Then, using the correlations, I weighted each part of the formula accordingly.
Yards to Go by Down = 50%
Field Position = 30%
Score Margin = 15%
Time Left by Winning/Losing = 5%
Field Position = 30%
Score Margin = 15%
Time Left by Winning/Losing = 5%
Lastly, I multiplied the chance of passing for each part by the weight and summed the results to get an overall percent change of passing. To determine if the play will be a pass or run I account for some randomness/unpredictability from KOK, so I have a randomly generated number between 0 and 1. If the number is less than the chance of passing, then KOK Bot says Pass, otherwise it says Run. If you want to see the whole calculation you can view the source of this page and read through the JavaScript.