Simulating Free Throws: Monte Carlo Method
Discussing required setup and challenges faced when building an NBA game simulator using the Mote-Carlo method.
Free throws exemplify what made building an accurate NBA simulator both unique and challenging. Free throws illustrate a simple game event, yet if expanded upon could become very situational and game-flow dependent. In their simplest form, they are very easy to explain: if a player gets fouled, they get multiple attempts to take a “free throw” from the foul line, and earn a point for each shot made. From a statistics point of view, this would be described as a binary distribution, with the probability of success being the percentage of the time a player makes a free throw. This is therefore relatively simple to simulate, as all that has to be done is to create a function that takes the number of free throws to be attempted as well as a shooting percentage, simulates the number of successes and failures, and returns the number of successes.
Easy, right? Yes, but when should we decide a player should take free throws? How many free throws should a player take? What about the bonus (free throws awarded for non-shooting fouls after the first 5 fouls have been called)? Or technical fouls? Or plays where a player was fouled, made the shot, but still earned an “and-one” free throw? What about when players foul intentionally at the end of the game, in hopes of getting the ball back to attempt a 3-point shot?
Suddenly, our simple act of simulating free throws has become not so simple. This illustrates many of the challenges faced when creating a game simulator, because although I wish I could program every single scenario, it is outside the scope of this project to program situational coaching logic and scenario-based game strategy. That being said, I still had to make sure the simulation is accurate and logical, and I also wanted to have a reason why I chose to include what I did.
In this specific case, I decided to include all shooting fouls that would lead to free throws, and also account for the different number of free throws awarded: two free throws for a missed two point shot, three free throws for a missed three point shot, and one free throw for a made shot that also had a foul. I chose to include these events for two major reasons: the first being that they are the most common ways players earn a trip to the free throw line (for example, technical fouls are rare compared to shooting fouls) and they also don’t require situational logic (such as intentional fouls in the bonus). This way, I am including both the most common occurrences, and am also able to accurately build simulations based on what we learned in this course.
I then used another binomial distribution, with the probability of success being the percentage of the time a team is fouled in the act of shooting (league average 13% of two pointers and 1% of three pointers via Sportico), and called the free throw function with the appropriate number of free throws and free throw percentage.
Simulations like this is what made up my NBA simulator. Check out my other blogs to read more!