class: center, middle, inverse, title-slide # Maximizing wOBA with Launch Angle and Exit Velocity ### Sarah Sult, Brooke Coneeny, Erin Franke ### 2021-11-01 --- ## Motivation - Two of the most popular stats in the MLB have recently been launch angle and exit velocity - We wondered: can we prescribe a wOBA maximizing launch angle for an individual player based on their power profile? -- ## First, a few definitions: - **wOBA** stands for weighted on base percentage. - We are only looking at batted balls (meaning no walks or hit-by-pitches) in this project, because that is what we have launch angle and exit velocity data on. - Each of the types of batted balls (out, single, double, triple, homers) are given a value - 0, 0.9, 1.25, 1.6, 2 - respectively - **Launch angle** means the vertical angle that the ball leaves a player’s bat after making contact. - **Exit velocity** measures the speed (in mph) the ball comes off the bat. --- ## Data - The majority of our analysis uses 2019 MLB data from Baseball Savant - Variables - Focus on modeling **wOBA** using **launch angle** and **exit velocity** - Other relevant variables we looked at during the exploratory process include **batter handedness, pitcher handedness, infield alignment, pitch type, at-bat outcome, location of where the ball was fielded** - Data is structured on a pitch-by-pitch basis <table> <thead> <tr> <th style="text-align:left;"> player </th> <th style="text-align:right;"> exit velocity </th> <th style="text-align:right;"> launch angle </th> <th style="text-align:right;"> wOBA </th> <th style="text-align:left;"> outcome </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Zobrist, Ben </td> <td style="text-align:right;"> 88.9 </td> <td style="text-align:right;"> -10 </td> <td style="text-align:right;"> 0.9 </td> <td style="text-align:left;"> single </td> </tr> <tr> <td style="text-align:left;"> Mazara, Nomar </td> <td style="text-align:right;"> 90.3 </td> <td style="text-align:right;"> 2 </td> <td style="text-align:right;"> 0.0 </td> <td style="text-align:left;"> field_out </td> </tr> <tr> <td style="text-align:left;"> Duda, Lucas </td> <td style="text-align:right;"> 106.4 </td> <td style="text-align:right;"> 12 </td> <td style="text-align:right;"> 0.9 </td> <td style="text-align:left;"> single </td> </tr> <tr> <td style="text-align:left;"> McCann, Brian </td> <td style="text-align:right;"> 96.4 </td> <td style="text-align:right;"> 29 </td> <td style="text-align:right;"> 0.0 </td> <td style="text-align:left;"> field_out </td> </tr> <tr> <td style="text-align:left;"> Hernández, Enrique </td> <td style="text-align:right;"> 89.3 </td> <td style="text-align:right;"> 16 </td> <td style="text-align:right;"> 0.9 </td> <td style="text-align:left;"> single </td> </tr> <tr> <td style="text-align:left;"> Muncy, Max </td> <td style="text-align:right;"> 97.4 </td> <td style="text-align:right;"> 44 </td> <td style="text-align:right;"> 0.0 </td> <td style="text-align:left;"> field_out </td> </tr> </tbody> </table> --- ## Hitters with high exit velocities have the ability to perform significantly better at launch angles in the mid 20s .pull-left[ <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-3-1.png" width="504" /> ] .pull-right[ <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-4-1.png" width="504" /> ] --- # Hit outcome by launch angle and exit velocity <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-5-1.png" width="1008" style="display: block; margin: auto;" /> --- #Breaking down the previous graph proportionally... <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-6-1.png" width="1008" style="display: block; margin: auto;" /> --- ### We can make wOBA-maximizing recommendations for changes in a player's launch angle based on their exit velocity .pull-left[ <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-7-1.png" width="576" style="display: block; margin: auto;" /> ] -- .pull-right[ <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-8-1.png" width="504" style="display: block; margin: auto;" /> ] --- ### Now how can we model these player recommendations? .pull-left[ - We will fit a **Generalized Additive Model, or GAM**, to **launch angle** and **exit velocity** with the target **wOBA** - GAMs have the ability to model complex *non-linear and non-monotonic* relationships between predictors and response variables, such as we see when we smooth the relationship between predictors **exit velocity** and **launch angle** with **wOBA**. ] .pull-right[ <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-9-1.png" width="432" /> <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-10-1.png" width="432" /> ] --- ### By using an interaction between launch angle and exit velocity in our GAM, we capture the true distribution of wOBA .pull-left[ **Actual relationship** <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-11-1.png" width="432" /> ] .pull-right[ **Our model's output** <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-12-1.png" width="432" /> ] --- ## Using a player's attack angle to predict launch angles .pull-left[ - A player's **attack angle** is the angle that the barrel of the bat travels through impact with the baseball - The attack angle is calculated by taking the **median of the player's top 10% highest launch speeds** - We then used this attack angle with pitch height to create a linear model which predicts a player's launch angles ] .pull-right[ <img src="https://v6e8y6s7.stackpathcdn.com/2014site/wp-content/uploads/2018/11/Swing-Planes-Positive-768x309.jpg" width="60%" height="45%" style="display: block; margin: auto;" /> <img src="https://v6e8y6s7.stackpathcdn.com/2014site/wp-content/uploads/2018/11/Swing-Planes-Negative.png" width="60%" height="45%" style="display: block; margin: auto;" /> ] --- ### Adding in pitch height to find a maximum wOBA over different attack angles - When adjusting a player's attack angle, our linear model gives us a set of new predicted launch angles for each ball hit into play - Exit velocities were sampled to create a mock data set representing this player's balls hit into play due to their new attack angle - This data was run though the wOBA model (GAM) to generate predictions of the player's potential production .pull-left[ <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-15-1.png" width="360" /> ] .pull-right[ <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-16-1.png" width="360" /> ] --- # Looking forward to the effects on K% rate - Sure, we can tell a player to increase or decrease their attack angle - but often times hitting with a steeper attack angle can be correlated with a higher strikeout rate, as seen in the graphs below. - As a result, we determined it crucial that we update our model so that it take into account that when a player changes his attack angle, the pitches he receives and makes contact with will change. .pull-left[ <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-17-1.png" width="432" /> ] .pull-right[ <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-18-1.png" width="432" /> ] --- # Attacking the assumption with a contact GAM - Changing the attack angle effects which pitches the batter will make contact with so we created a GAM to predict contact. - Defined contact as anything hit foul or into play. - Model predictors: - interaction between pitch height and horizontal pitch location - interaction between attack angle and pitch approach angle - pitch speed - Evaluated model on test data and chose to predict a swing and miss at a threshold of 0.22 in order to balance specificity and sensitivity - 68.7% accuracy at predicting contact - 66.4% accuracy at predicting swing and misses --- # Contact GAM - successes and problems - Grouped players by name and year and found their attack angle and true swing and miss percentage. We then compared the predicted values to the average proportion of swing and misses that player had from our model in order to test accuracy. .pull-left[ <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-19-1.png" width="432" /> ] .pull-right[ <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-20-1.png" width="432" /> ] --- ### Once we narrowed down how contact changes with attack angle, we explored how attack angle effects a batters ability to hit pitches fair. - Our main hypothesis was that faster pitches with more spin further from the heart of the plate are fouled off more often, which can be seen in the graphs below .pull-left[ <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-21-1.png" width="432" /> ] .pull-right[ <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-22-1.png" width="432" /> ] --- # The fair-foul gam - Note to start: It's really hard to predict whether a ball will be hit fair or foul! It is so dependent on timing and that's really hard to measure. - We decided to once again create a GAM model, this time modeling fair or foul balls. - The GAM uses predictors of: - interaction between pitch height and horizontal pitch location - interaction between release speed and release spin rate - interaction between attack angle and approach angle - Given contact, almost exactly 50% of balls are hit foul. - Final fair-foul GAM was able to predict 52.7% of foul balls correctly and 63.7% of fair balls correctly for an overall accuracy of 58.2%. --- # Implementing Contact & Fair/Foul GAMs - We created a function which took our contact GAM, fair/foul GAM, and player data - This function returned an updated player data set containing the pitches which were predicted to be hit fair - We then sent this new dataset into a function similar to our original, except now returning a predicted wOBA for all pitches, not only those which batters made contact with `$$wOBA = \frac{.69*uBB + .72*HBP + .89*1B + 1.27*2B + 1.62*3B + 2.1*HR}{AB + BB - IBB + SF + HBP}$$` --- # What's going wrong? - Theoretically, once a batter starts swinging at higher attack angles, they will begin to miss more pitches. As they miss more pitches, the wOBA of a batter should decrease considering they will be getting on base less often. - However, when we graph our results we find that wOBA continues to increase with attack angle without plateauing. .pull-left[ <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-23-1.png" width="432" /> ] .pull-right[ <img src="CMSAConference_presentation_files/figure-html/unnamed-chunk-24-1.png" width="432" /> ] --- # Thank you! If you would discuss this work further, please reach out to us: - Sarah Sult: sarahesult@gmail.com - Brooke Coneeny: bconeen1@swarthmore.edu - Erin Franke: efranke@macalester.edu