<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sam Bornstein on Medium]]></title>
        <description><![CDATA[Stories by Sam Bornstein on Medium]]></description>
        <link>https://medium.com/@sambornstein?source=rss-f8ed5128e71e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*zX8pNPRcH9BrwUlu-no4wQ.png</url>
            <title>Stories by Sam Bornstein on Medium</title>
            <link>https://medium.com/@sambornstein?source=rss-f8ed5128e71e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 01:15:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sambornstein/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[My Advice on How to Land a Job in Baseball]]></title>
            <link>https://sambornstein.medium.com/my-advice-on-how-to-land-a-job-in-baseball-f5882e653b5e?source=rss-f8ed5128e71e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5882e653b5e</guid>
            <category><![CDATA[simple-sabermetrics]]></category>
            <category><![CDATA[baseball]]></category>
            <category><![CDATA[baseball-analytics]]></category>
            <category><![CDATA[baseball-industry]]></category>
            <category><![CDATA[mlb]]></category>
            <dc:creator><![CDATA[Sam Bornstein]]></dc:creator>
            <pubDate>Fri, 10 Dec 2021 21:26:17 GMT</pubDate>
            <atom:updated>2021-12-10T21:27:05.364Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Note: This article was originally posted at </em><a href="https://www.simplesabermetrics.com/post/preparing-for-a-career-in-baseball"><em>Simple Sabermetrics</em></a><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*HUAmQL_h4th0GiiQhfMIcA.jpeg" /></figure><p>To close out Season 2 at Simple Sabermetrics, I’d like to shift the focus from my previous articles on data analytics. Instead of writing about different stats or providing code tutorials, I’m going to take a step back and offer some insight on how you can apply the material you’ve learned from this site and strengthen your candidacy for a position in the baseball industry.</p><p>As a disclaimer, none of this advice should be taken as gospel. There is no single blueprint to break into the baseball industry. This article does not have any magic secrets that instantly pushes your resume onto the top of an MLB executive’s desk. It’s intended to provide a guide for high school and college students on how to maximize their potential as they spend the next few years of their life preparing for the next steps in their career.</p><h3>Primer</h3><p>Let’s cover our bases before we begin. Your first and foremost priority should be developing the technical skills relevant to the position you are working towards.</p><p>For an analyst position, for example, you need to be a proficient programmer. Sure, meaningful experiences and a strong network of connections are important, but the best thing you can do to prepare yourself years ahead of applying for your dream job is to start developing the technical skills listed on the job description.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*DwxlKvX_gXmj7rDTpt9Pdw.jpeg" /><figcaption><em>Qualifications for a Baseball Operations Analyst role in 2020</em></figcaption></figure><p>These skills are not learned overnight or even through the course of just one semester. Just as it takes repetitions in practice for an athlete to master a certain movement pattern or adjustment in their swing, it takes time and effort for an analyst to become comfortable with statistical concepts.</p><p>Hopefully this introduction did not come as a surprise to you. It should be implied that you must have a toolbox of skills for a technical position. Now, let’s dive into tangible and intangible ways to build valuable experiences with your technical skill set.</p><h3>Experiences</h3><p>We can begin by covering the practical routes chosen in recent years by people seeking a career in baseball. The evolution of the analytics era has brought out many new ways for people to get involved and share their creativity with like-minded individuals. Whether it’s working for your college’s baseball program or writing independent research, there’s no excuse for someone not to have some level of experience by the time they graduate college.</p><h4>The College Student Manager Route</h4><p>It would be remiss of me not to mention the role of a student manager, given that all Simple Sabermetrics blog writers have held that position during college. We are biased, of course, but it seems that this route is becoming more popular and we are seeing many college student managers make the leap into professional baseball.</p><p>Professional and college baseball are unique in their own ways, but at their base, similarities exist that make the experience as a student manager extremely valuable. The clear differences between the two revolve around the acquisition of players. There is less “business” involved at the amateur level, as there are no trades, free agents, contract negotiations, or amateur drafts.</p><p>Therefore, we can identify three main pillars of similarity between both levels: player development, player evaluation, and advance scouting. These three areas fall under the umbrella of research and development, in that research is completed to build better principles throughout an organization and applications or other methods of deliverables are developed as a means of communicating these insights to others.</p><p>A few tasks under these pillars include scripting individualized plans for players, creating metrics to evaluate performance, building an all-encompassing pitch-grading model, assessing opposing players for upcoming games, and proposing a new in-game strategy to a coaching staff. Because of the landscape that this new analytics era has created, the experience in college baseball is directly applicable at the next level. You’re essentially taking advantage of an internship opportunity that allows you to develop both your technical and interpersonal skills.</p><p>As a reminder, the experience only takes you so far; the sought out talent in this industry remains an analyst’s skill to interpret data and provide unique and valuable insights as a member of a team. It’s great to learn how to operate technology with a college program, but in every job in life, skills like that can be taught during an on-boarding period. The true value one can bring to an organization is their unique perspective to drive decision-making.</p><p>Lastly, teams strongly value those that possess the ability to communicate technical concepts to non-technical people. All the data in an organization could be analyzed, but it doesn’t become valuable until it has been integrated directly to the on-field product. Not all athletes and coaches think the same way as analysts, so it becomes the analyst’s responsibility to communicate their insights successfully and bridge the gap between their work and the ones using it. The college baseball environment is a great place to practice these soft skills when there is a staff of about five coaches and a roster between 35 and 40 players.</p><h4>The Independent Route</h4><p>There are plenty of reasons for someone to choose not to join a college student manager staff. For some, that could be because their college does not have a baseball program or that their baseball program lacks all the tools necessary to extract the most value from the experience. For others, they are more fascinated by the prospect of analyzing MLB data and spending their time completing independent research and writing blogs.</p><p>There is tremendous value in creating a part-time job out of independent research. It has paid off for so many people, landing them analyst positions in MLB or as staff writers for publications like <a href="https://blogs.fangraphs.com/">FanGraphs</a>, <a href="https://www.baseballprospectus.com/">Baseball Prospectus</a>, or <a href="https://theathletic.com/">The Athletic</a>. Most of these writers started by publishing blogs on their own. Like the music industry, you’re guaranteed to start off with very little impressions, or views. Your second article will be better than your first, your third better than your second, and so on. It’s how it works; over time, and with the development of your analysis, an audience could begin to grow.</p><p>However, regardless of the number of explicit impressions your work receives, there are always people that read articles and share with their peers. Many organizations keep tabs on the public blog-sphere and are often assigned to send weekly summaries on recent public research.</p><p>The bottom-line is that there is a market for public baseball analytics research that is consumed by both fans and fellow baseball analysts looking to connect with others and share feedback. It’s a great way to become a better analyst and solve baseball problems that are directly scalable to what MLB teams are trying to solve as well.</p><h3>Standing Out in the Crowd</h3><p>The baseball industry is a competitive field. If your focus lies in professional baseball, there are only 30 teams. This is much different compared to, say, the business industry where there may be more than 30 companies located in a few square miles in downtown Chicago. Needless to say, you are going against many candidates for a single position. So, what can you do to stand out above the rest?</p><h4>Write</h4><p>Without being redundant from the previous section, it’s imperative to understand the value of sharing your work. Building a portfolio that goes beyond your resume and experiences provides your candidacy value. It makes it easier for employers to validate your skills with the long-form publications that you’ve released.</p><p>Pairing your independent analysis with a long-form writeup is the main channel of showcasing your analytical and communication skills. It further demonstrates your ability to understand your discoveries and receive feedback and questions from your readers.</p><p>Not sure what to write about? Head over to the websites linked above, visit FanGraphs’ <a href="https://community.fangraphs.com/">Community Blog</a> (also a great place to submit articles), or skim through the topics that have been written about on this blog for over a year.</p><h4>Tweet</h4><p>Twitter is a platform for blogs to be shared with high-level overviews provided to give the user a reason to read the entire article. It’s a place for others to share your work, ask questions, and provide feedback.</p><p>While some people may shy away from this, Twitter can be used to your advantage by sharing bite-size insights that require less time to create and less time for your readers to consume. Here’s an example from a friend, <a href="https://twitter.com/conhinch">Connor Hinchliffe</a>.</p><h3>Connor Нinchliffe on Twitter: &quot;THREAD: Alek Manoah had his MLB debut yesterday, shutting out the Yankees over 6 innings and showcased an impressive arsenal. Using our @DrivelineBB In-Season Report, I wanted to highlight the performance of a fun prospect pic.twitter.com/k9Gy2G0SJ0 / Twitter&quot;</h3><p>THREAD: Alek Manoah had his MLB debut yesterday, shutting out the Yankees over 6 innings and showcased an impressive arsenal. Using our @DrivelineBB In-Season Report, I wanted to highlight the performance of a fun prospect pic.twitter.com/k9Gy2G0SJ0</p><p>This embedded tweet thread from May is a breakdown of Driveline’s In-Season Report for Alek Manoah. Now, most others won’t have access to that, but the way in which Connor shared his insight in the thread is a great breakdown and created a place of discussion on Twitter.</p><p>Similar to those that got their start through FanGraphs, Baseball Prospectus, or their own blog, there’s also been a recent wave of popular baseball Twitter users making the jump to professional baseball, such as <a href="https://twitter.com/ckurcon">Connor Kurcon</a> and <a href="https://twitter.com/choice_fielder">Max Bay</a>.</p><h4>Network</h4><p>The same can be said in most industries, but it truly is essential in baseball to build a strong network of connections — not only with potential employers but also with people who can speak on your behalf. As I mentioned earlier, it’s a competitive field. If you’re up against another equally-talented candidate for the same position and you have a stronger reference than that person, you have the advantage.</p><p>Networking isn’t just for the purpose of seeking a job from an individual. There’s value in reaching out to people who work in positions you find desirable to learn more about their background. They can share how they got to their current position and offer first-hand advice on how to follow a similar path. These connections come naturally and become more authentic over time.</p><p>Networking also includes making connections with those that are on the same path as you. In college baseball, student managers have lots of respect for each other and the amount of work that is required every day. Each program is run differently, so student managers have so much to share with each other.</p><h4>Learn</h4><p>Stay up to date with analytics trends. No, this does not mean watching Moneyball. The analytics evolution of the past decade has not stopped growing. There seems to be a new competitive advantage every couple years. Recent trends included biomechanics and sports science, but what’s next? The San Francisco Giants could be onto<a href="https://theathletic.com/2798606/2021/08/31/rosenthal-san-franciscos-secret-giants-say-young-unconventional-coaches-fuel-their-surprising-success/"> something</a>. Regardless of what is next, there are endless resources available to you to foresee these developments in baseball and learn more about them.</p><p>A subscription to The Athletic or Baseball Prospectus is worth it. If something like that isn’t in your budget, there are many more websites with daily articles or podcasts about fascinating baseball analytics topics such as<a href="https://blogs.fangraphs.com/"> </a>FanGraphs or<a href="https://www.drivelinebaseball.com/blog/"> Driveline’s research blog</a>. If you have trouble keeping up with new articles, Driveline offers a weekly newsletter, titled<a href="https://mailchi.mp/drivelinebaseball.com/newsletter"> Sunday Thunder Nuggets</a>, with five or more articles from the previous week.</p><p>Finally, Twitter is best used as a professional tool once you decide that a career in baseball is for you. Following the right accounts and people can curate a feed that provides articles and bite-size tweets that grow your knowledge without taking the effort to search for them.</p><h3>Final Words</h3><p>As we wrap this up, I want to reiterate that there is no single blueprint to follow to work in baseball. Everyone follows their own unique path into the baseball industry; there’s value in being different and scripting what you believe is best for your future. If I could leave you with one piece of advice, it would be to avoid being the smartest person in the room. Place yourself in an environment to learn from others.</p><p>To prove that there are other viewpoints, I want to share a similar article that a friend of mine, <a href="https://twitter.com/Moore_Stats">Ethan Moore</a>, wrote where he shares his advice on finding a job in professional baseball. It’s a great read and hits some areas that were not discussed in this blog. Check out Ethan’s article <a href="https://medium.com/something-tangible/my-mlb-job-hunting-experience-eb578377e478">here</a>!</p><p>As always, do not hesitate to reach out to me on <a href="https://twitter.com/Sam__Bornstein">Twitter</a> or <a href="https://www.linkedin.com/in/sambornstein/">LinkedIn</a>. If there’s anything you’d like me to expand upon from this article, please feel free to ask. I’d be happy to make the connection and offer anything I can. All I ask is that you pay it forward when people reach out to you with questions one day. And with that, thank you for reading and best of luck!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5882e653b5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing Breaking Ball Shape Through Data-Driven Pitch Design, Part Two]]></title>
            <link>https://sambornstein.medium.com/optimizing-breaking-ball-shape-through-data-driven-pitch-design-part-two-31b326ac0963?source=rss-f8ed5128e71e------2</link>
            <guid isPermaLink="false">https://medium.com/p/31b326ac0963</guid>
            <category><![CDATA[driveline]]></category>
            <category><![CDATA[pitch-design]]></category>
            <category><![CDATA[baseball]]></category>
            <dc:creator><![CDATA[Sam Bornstein]]></dc:creator>
            <pubDate>Sat, 23 Oct 2021 22:22:10 GMT</pubDate>
            <atom:updated>2021-10-23T22:22:10.838Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Note: The following is a preview of an article published at </em><a href="https://www.drivelinebaseball.com/"><em>Driveline Baseball</em></a><em>. Follow the link at the bottom of this page to read the full article.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*TjA3nosiQBmcTUsM" /></figure><p>In <a href="https://www.drivelinebaseball.com/2021/09/optimizing-breaking-ball-shape-through-data-driven-pitch-design-part-one/">part one</a> of this breaking ball pitch design series, we introduced a method to calculate expected velocity differentials in breaking balls compared to an athlete’s fastball.</p><p>We took a generalized approach to assess an athlete’s breaking ball and fastball characteristics to end up with an expected velocity differential for cutters, sliders, and curveballs. This allows us to say, for example, how much velocity we’d expect a certain athlete’s slider to drop relative to his average fastball speed in that time period.</p><p>The use case for this model is fairly straightforward: If an athlete is throwing a pitch slower than what our model expects, we can predict that this athlete may have low feel for a breaking ball and still have room to improve the pitch, overall.</p><p>If we recommend that the athlete increase the pitch’s speed to match the expected velocity, we would like to know if that potential improvement comes with additional considerations or tradeoffs worth quantifying.</p><p>In this piece, we introduce the velocity-spin efficiency tradeoff and explain how we can utilize that relationship to foresee potential changes in pitch shapes if velocity is increased.</p><p><em>The full article was originally published at </em><a href="https://www.drivelinebaseball.com/blog/"><em>Driveline Baseball</em></a><em> on October 12, 2021 and can be viewed </em><a href="https://www.drivelinebaseball.com/2021/10/optimizing-breaking-ball-shape-through-data-driven-pitch-design-part-ii/"><em>here</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31b326ac0963" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing Breaking Ball Shape Through Data-Driven Pitch Design, Part One]]></title>
            <link>https://sambornstein.medium.com/optimizing-breaking-ball-shape-through-data-driven-pitch-design-part-one-f8bc6818ea8b?source=rss-f8ed5128e71e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8bc6818ea8b</guid>
            <category><![CDATA[driveline]]></category>
            <category><![CDATA[baseball]]></category>
            <category><![CDATA[pitch-design]]></category>
            <dc:creator><![CDATA[Sam Bornstein]]></dc:creator>
            <pubDate>Sat, 23 Oct 2021 22:19:41 GMT</pubDate>
            <atom:updated>2021-10-23T22:19:41.605Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Note: The following is a preview of an article published at </em><a href="https://www.drivelinebaseball.com/"><em>Driveline Baseball</em></a><em>. Follow the link at the bottom of this page to read the full article.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/0*cGMzsKDDuRiGl6RJ" /></figure><p>With technologies like Rapsodo, TrackMan, and Yakkertech reaching the mainstream in recent years, designing a specific breaking ball for an athlete has never been more straightforward to accomplish.</p><p>Big leaguers are using advances in Pitch Design <a href="https://www.mlb.com/news/adam-ottavino-discusses-pitch-design-and-data-c301645978">to their advantage</a> to increase velocity and add additional sweep and depth to their breaking balls, <a href="https://www.washingtonpost.com/sports/2019/05/21/velocity-is-strangling-baseball-its-grip-keeps-tightening/">helping them achieve a record number of strikeouts in the process</a>.</p><p>Of course, we know that we’ve always been striving for more sweep, more depth, and more velocity with breaking balls, and, as a function of that, <a href="https://www.mlb.com/news/best-sliders-in-baseball-2020">the league’s average slider has only gotten nastier over time</a>. But, let’s consider a more likely scenario: what if adding sweep to a breaking ball comes with a loss of velocity, or adding velocity comes with a loss of depth and spin efficiency?</p><p>How do we optimize the three components of improving a breaking ball while being cognizant of the nuanced tradeoff between them all?</p><p>In this blog, we’ll try to tackle some of those hard hitting questions by providing context using MLB data and Driveline’s internal models — models we use with our own high-level athletes in Pitch Design sessions. This will be part one of a two-part breaking ball pitch design blog series.</p><p><em>The full article was originally published at </em><a href="https://www.drivelinebaseball.com/blog/"><em>Driveline Baseball</em></a><em> on September 17, 2021 and can be viewed </em><a href="https://www.drivelinebaseball.com/2021/09/optimizing-breaking-ball-shape-through-data-driven-pitch-design-part-one/"><em>here</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8bc6818ea8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Strengthening Baseball Data Through Paired Analysis]]></title>
            <link>https://sambornstein.medium.com/strengthening-baseball-data-through-paired-analysis-7aaa41f37c1d?source=rss-f8ed5128e71e------2</link>
            <guid isPermaLink="false">https://medium.com/p/7aaa41f37c1d</guid>
            <category><![CDATA[blast-motion]]></category>
            <category><![CDATA[rapsodos]]></category>
            <category><![CDATA[trackman]]></category>
            <category><![CDATA[hittrax]]></category>
            <category><![CDATA[simple-sabermetrics]]></category>
            <dc:creator><![CDATA[Sam Bornstein]]></dc:creator>
            <pubDate>Sun, 03 Oct 2021 21:18:41 GMT</pubDate>
            <atom:updated>2021-10-03T21:18:41.043Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Note: This article was originally posted at </em><a href="https://www.simplesabermetrics.com/post/strengthening-baseball-data-through-paired-analysis"><em>Simple Sabermetrics</em></a><em>. I post articles monthly on the Simple Sabermetrics blog and soon after re-post it here on my Medium account.</em></p><p>Simple Sabermetrics has released a myriad of videos and blogs covering tracking technologies that have made their way into baseball over the last few years. These advances in technology have unlocked new ways for the community to analyze baseball and provide athletes with more sophisticated methods of development.</p><p>At the center of all the technology is the data that is collected. Baseball data is collected in many different ways, from pitch flight and batted ball flight to swing path, biomechanics and more. We’ve written about <a href="https://www.simplesabermetrics.com/post/data-driven-decisions">how to use data to inform your decisions</a> and <a href="https://www.simplesabermetrics.com/post/the-value-of-being-a-data-driven-program-part-1">the value of being a data-driven program</a>, as well as published videos that have introduced the basics of each technology. This includes <a href="https://www.youtube.com/watch?v=sOrEpI9DpL8">Trackman</a>, Rapsodo <a href="https://www.youtube.com/watch?v=tkd5DcapAHc">Pitching</a> and <a href="https://www.youtube.com/watch?v=3Tn6zpz29lQ">Hitting</a>, <a href="https://www.youtube.com/watch?v=b3zulsvTfTY">Blast Motion</a>, and more.</p><p>So, we’ve covered the basics and importance of the data that these devices track, but we’ve never discussed the value of <em>pairing</em> the data across more than one system. Because each of these tracking devices are unique in their own space, they have limitations. That’s where we must get creative with the tools at our disposal. Pairing one tracking technology with another expands the possibilities to extract the most out of the data being collected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*izPHtagQEJP9gvEL1G8acA.jpeg" /></figure><p>As we move forward in this new era of technology and analytics, it’s certainly possible that some of these inefficiencies shrink through new inventions and upgraded hardware or software. For example, the new pitch-tracking system at the MLB-level, Hawk-Eye, is able to track data points beyond just ball flight, such as player movement, but the general public does not have access to such rich data. Hawk-Eye has yet to fully infiltrate every MiLB stadium, so it may be years until it makes its way down to amateur baseball.</p><p>Let’s consider a few reasons why pairing one system’s data with another provides value beyond belief to your organization.</p><p><strong>Combining Swing and Hit Data</strong></p><p>Blast Motion and Diamond Kinetics are the two most common bat sensors on the market. If you aren’t familiar with bat sensors, this video <a href="https://www.youtube.com/watch?v=VZ7xmiWTPKg&amp;list=PLR4xG5nxrEjZnDFTYWTBwMcTi96PelLSB">here</a> is a great start. These sensors are able to track metrics such as bat speed, attack angle, and on-plane efficiency. In a vacuum, these metrics are valuable to identifying swing deficiencies, but sometimes require additional data to better inform a decision.</p><p>Although these two companies have released versions of their product to measure batted ball data, these methods of estimating exit velocity or launch angle are best left to technology specifically designed to track those metrics, such as HitTrax or Rapsodo Hitting. Both of these systems track the flight of the ball after contact has been made.</p><p>An athlete hitting with a bat sensor while on a HitTrax or Rapsodo Hitting unit is the most straightforward method of pairing tracking technologies to acquire two times the data points. For example, we can measure an athlete’s average attack angle by part of the strike zone. Below, we can see that this left-handed hitter maintains a consistent attack angle throughout the zone, except the up-and-in area where it decreases by a few degrees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*U4kfjhYlWMe0NFDmdyUHXg.jpeg" /></figure><p>We know it’s best to take an individualized approach to each hitter’s development plans. By using the paired swing and hit data, we can identify where each athlete is maximizing their strengths, whether that be your desired Blast Motion metric in each area of the strike zone or in which range of a Blast Motion metric the athlete is hitting the ball the hardest.</p><p>The heavy lifting on the back-end of this method is deciding exactly how to pair each observation in both datasets. Each piece of technology will generate their own unique ID for each observed swing or batted ball, so we must rely on pairing the instances with timestamps.</p><p>There’s no surprise that we’ve seen MiLB hitters begin to wear their bat sensors during games to pair with Trackman or Hawk-Eye batted ball data. While it seems that the pitching community has had better resources to develop athletes over the years, the hitting community can utilize these pairing techniques to advance the methods used to develop their athletes.</p><p><strong>Validation, Experiments, and Models</strong></p><p>Performing validation tests on the technology you own doesn’t directly impact the development of an athlete, but it provides you the comfort of better understanding the data you collect.</p><p>So, what exactly is validation and how do we determine which system we use as a baseline of the truth? Unfortunately, the latter question does not have a definite answer. Each tracking technology has their strengths and weaknesses that we need to keep in mind, but we can use validation methods to find evidence of specific areas of interest.</p><p>Validation mainly entails calculating the estimated differences in measurements between systems, but it can also include analyzing the system’s performance under various anticipated operating scenarios. Optical pitch-tracking devices can often suffer from sudden changes in lighting outdoors or indoors. Various systems could capture ball flight or swing paths less frequently for a certain type of athlete (i.e. handedness, height, etc.).</p><p>For a full validation analysis, Driveline Baseball published an article for Rapsodo’s 2.0 Pitching unit back in July of 2019. That piece can be found <a href="https://www.drivelinebaseball.com/2019/07/validating-rapsodo-2-0-pitch-design-made-easier/">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*Z8tzp0UmGmv1UzrGGC8vLw.jpeg" /></figure><p>With a group of people and some free time, you can experiment with multiple tracking technologies to perform your own validation. For readers that work for a college program with a stadium pitch-tracking unit and a mobile pitch-tracking device, set up these systems at the same time on the field and throw a handful of pitches. If one of your units is a radar system (e.g. Trackman) and the other is optical (e.g. Rapsodo), what do you notice? Are the movement variables and spin directions different? <a href="https://tht.fangraphs.com/comparing-the-rapsodo-baseball-device-to-other-pitch-trackers/">They should be</a>. There shouldn’t be a tremendous gap between the two system’s other measured variables, but it is an interesting exploration nonetheless.</p><p>A paired data set is a rich resource that has use-cases beyond validating each system. Rapsodo measures variables that Trackman cannot, simply due to the nature of the system. With a healthy sample size, you now have a training sample of Trackman data with Rapsodo spin efficiency and gyro degree. Building a model to predict these two measures strictly using the variables that are measured by Trackman becomes a possibility. Pending an accurate model, Trackman no longer needs its partner, Rapsodo, to measure spin efficiency in games. Besides, you’ll find no luck setting up a Rapsodo on-field in the middle of a regular season game.</p><p><strong>Qualitative Analysis with High-Speed Video</strong></p><p>High-speed video is another form of data that is paired well with quantitative data to gather vastly superior insights. It’s a creative blend of qualitative and quantitative analysis. Without thinking about it, capturing Edgertronic video during Rapsodo bullpen sessions qualifies under our paired data umbrella. The pitch-tracking device measures dozens of data points on the flight of the ball, whereas the camera films the ball release and trajectory at thousands of frames per second.</p><p>A pitch-design session is not complete without the pairing of these two devices. The coach or trainer uses both resources together to make better-informed decisions. The slight change of grip or release motion is observed with the video and the subsequent change in pitch shape is detected through the pitch-tracking system. You can see an example of this combination in the tweet from Eric Jagers below.</p><h3>Eric Jagers on Twitter: &quot;For your viewing pleasure: 99% Spin Efficiency Curveball on the new @rapsodo INSIGHT 👀🔨 pic.twitter.com/MA6hNaXKab / Twitter&quot;</h3><p>For your viewing pleasure: 99% Spin Efficiency Curveball on the new @rapsodo INSIGHT 👀🔨 pic.twitter.com/MA6hNaXKab</p><p>A qualitative experiment that can be performed with video is validating newer ball flight metrics such as seam orientation, which is measured in Yakkertech’s stadium pitch-tracking unit. There are no other systems that track the seam orientation of the baseball as it is released, so we cannot quantitatively compare the differences in values to another measure. Instead, we can capture high-speed video to estimate the accuracy of these measures.</p><p><strong>Looking Ahead</strong></p><p>As these tracking technologies become more commonplace in professional and amateur baseball, we must find new ways to stay ahead of the curve. Many organizations have put themselves past others in the biomechanics realm, but there is a point the industry reaches where most everyone has the same technology. The new competitive advantage belongs to those who find new methods of extracting the most value from their resources, which exponentially expands the number of insights possible to develop athletes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7aaa41f37c1d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Guide to Baseball’s Expected Statistics]]></title>
            <link>https://sambornstein.medium.com/a-guide-to-baseballs-expected-statistics-8ecfab280eb8?source=rss-f8ed5128e71e------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ecfab280eb8</guid>
            <category><![CDATA[simple-sabermetrics]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[xwoba]]></category>
            <category><![CDATA[statcast]]></category>
            <category><![CDATA[expected-batting-average]]></category>
            <dc:creator><![CDATA[Sam Bornstein]]></dc:creator>
            <pubDate>Mon, 23 Aug 2021 19:48:28 GMT</pubDate>
            <atom:updated>2021-08-23T19:48:28.877Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Note: This article was originally posted at </em><a href="https://www.simplesabermetrics.com/post/a-guide-to-baseball-s-expected-statistics"><em>Simple Sabermetrics</em></a><em>. I post articles monthly on the Simple Sabermetrics blog and soon after re-post it here on my Medium account.</em></p><p>Statistics that prefix with the letter “x” have made their way into baseball broadcasts across the country over the last couple years, and it’s <em>refreshing</em>. We’ve seen broadcasts finally showcase something other than batting average as the all-encompassing metric to define a hitter’s production. Some scoreboards in major league stadiums are showing OPS next to each hitter in the lineup before the game begins. In many ways, sabermetrics have taken over. That’s why you’re here, reading this article, right? As always, here at Simple Sabermetrics we are going to keep things <em>simple</em>. That means this will be a high level overview of expected statistics.</p><p>One of Jake’s <a href="https://www.youtube.com/watch?v=jEuP-vJC8lA">recent videos</a> explored the luckiest and unluckiest hitters in MLB this season in terms of their <em>actual</em> performance to their <em>expected</em> performance. This particular slide was showcased, and it’s a great starting point to wrap your head around what we’re going to talk about.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NB5OdbA6Qyr72F8lG38B-A.jpeg" /></figure><p>As the video mentions, there are three factors that can be pinpointed to determine bad luck in baseball.</p><p><em>Hard Hit Outs</em></p><p>A well-struck baseball at 110 MPH exit velocity can be turned into an out as quickly as a 60 MPH <a href="https://www.thebaseballjournal.com/terminology/worm-burner-baseball-terminology/">worm burner</a>. That’s part of the beauty of the game, and yet another reason why analytics have become so important in player evaluation (and just about every facet of the game). It’s no secret that players that consistently hit the ball hard are going to produce better results than players who do not. Some just will experience different levels of fate than others, and that’s where the “luck” is involved.</p><p><em>Park Factors</em></p><p>We won’t spend much time covering park factors within this piece. Jake’s example, while extreme, is a great testimony to the vast differences of ballpark dimensions across the league. Some types of batters thrive at certain ballparks, such as left-handed hitters at Yankee Stadium for its short porch in right field. Beyond outfield fence distances or heights, atmospheric conditions can also affect a batted ball’s outcome. Coors Field’s atmospheric conditions are why the ball travels further than every other stadium, as we saw in this year’s home run derby. The luck involved here is hitting a ball where the park factors will either benefit or limit the outcome.</p><p>If you’re looking to learn more on this topic, check out Jake’s <a href="https://www.youtube.com/watch?v=nzcsAdtwq_A&amp;t=23s">video</a> on this from last week.</p><p><em>Expected vs. Actual</em></p><p>This is the main focus of this article. The best method to capture the variance in production for a hitter or single batted ball event is investigating the differences between actual and expected outcomes. The most popular expected statistics in this technologically-savvy baseball era include expected batting average (xBA), expected slugging percentage (xSLG), and expected weighted on-base average (xwOBA). Each of these are developed by MLB’s Statcast team and are publicly available on <a href="https://baseballsavant.mlb.com/">Baseball Savant</a>. Let’s dig into detail on each of these.</p><p><strong>Expected Batting Average</strong></p><p>The <a href="https://www.mlb.com/glossary/statcast/expected-batting-average">expected batting average</a> of a single batted ball is the probability of that event becoming a hit. Simply, that is referred to as “hit probability”, which Statcast used to call this metric. The main difference is the former metric was represented as a percentage, whereas xBA is presented on the same scale as batting average. So, a line drive to left field with a .620 xBA equates to a 62% hit probability.</p><p>Statcast calculates xBA using the two main drivers of the likelihood of a hit after a ball has left the bat: exit velocity and launch angle. Sprint speed was introduced in 2019 as a variable for <a href="http://tangotiger.com/index.php/site/article/statcast-lab-radial-woba-by-launch-anglespeed">“topped” and “weakly hit”</a> batted balls. This helped to account for players more likely to beat out infield singles.</p><p>Other factors can include the spray angle, ballpark, atmospheric conditions, or defensive positioning, but these are excluded to focus solely on what’s most in the player’s control. Various hit probability models out there may have spray angle included to better describe an individual batted ball event, which is further removed from Statcast’s <a href="https://twitter.com/tangotiger/status/1274803740604841985">main goal</a> — describing the production of the player.</p><p>As we begin to collect a sample of a hitter’s batted ball events, the player’s overall expected production starts to take shape. With a healthy sample size, the average of a batter’s xBA events form his <em>expected batting average on contact</em>, otherwise called xBACON. Strikeouts are then factored in to arrive at the final expected batting average.</p><p>Let’s see how MLB hitters in 2021 are hitting compared to their expected batting average.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*IZKiHYYHT5pDmxaO-pBNJA.png" /></figure><p>On the x-axis is the actual metric and on the y-axis is the expected metric. Players that sit below the red line are “over performing” where there may be luck or other factors that contribute to a higher than expected production. On the flip side, players above the line may have had the opposite fortune and are labeled as “under performing”. The plot labels the three players on each side that outperform or underperform their actual batting average the most. Randy Arozarena, Akil Baddoo, and Yuli Gurriel have experienced the most good luck out of all hitters with at least 150 plate appearances so far this season.</p><p>Similar to batting average, xBA still lacks the power to measure a player’s ability to hit more extra bases. That’s where expected slugging percentage is introduced.</p><p><strong>Expected Slugging Percentage</strong></p><p>Slugging percentage accounts for extra-base hits, which takes our measurement a bit further because of the glaringly obvious fact that extra-base hits are far more valuable. So, similar to xBA, <a href="https://www.mlb.com/glossary/statcast/expected-slugging-percentage">expected slugging percentage</a> factors in the same two batter skills — exit velocity and launch angle — to measure quality of contact.</p><p>The means to arrive at the end product are a bit different from the first metric we explored. Since there are four different types of base hits, the probabilities for each of them are plugged into the formula for slugging percentage.</p><blockquote><em>xSLG = (P(1B) + P(2B) * 2 + P(3B) * 3 + P(HR) *4) / At-Bats</em></blockquote><p>A more complex method than xBA, but still simple enough to comprehend the concept that each type of base hit is weighed differently. The probability of an out still exists in this scenario, but is excluded because it is not needed in the formula. It is indirectly included as the sum of the four probabilities will add up to less than 100% with the remainder then being the out probability.</p><p>To recap xBA and xSLG, let’s consider a ball with an exit velocity of 95 MPH and a 15 degree launch angle. For this example we will use actual outcomes instead of expected, but the concept remains the same for what we are about to uncover.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*1y3ZhPDESnVeUSDf7yAmRQ.jpeg" /><figcaption><em>Image from Baseball Savant’s </em><a href="https://baseballsavant.mlb.com/statcast_field?ev=95&amp;la=15"><em>Field Visualizer</em></a></figcaption></figure><p>Batted balls with this pair of metrics resulted in a hit 75.6% of the time, but of those hits, it went for a single base hit over half of the time. This is great, but extra-base hits are more valuable. xSLG detects the power production of the batted ball instead of just the binary outcome. This eliminates further variance caused by the randomness of factors outside the player’s control.</p><p>Therefore, xSLG is more indicative of a batter’s offensive production than xBA because it measures that quality instead of the ability to find green grass and reach base. But, there’s still one downfall of these two metrics. They do not account for <em>all</em> of a batter’s plate appearance. So far, these two have only included quality of contact and strikeout percentage.</p><p><strong>Expected Weighted On-Base Average</strong></p><p>If you aren’t familiar with wOBA, be sure to check out <a href="https://www.youtube.com/watch?v=qXEj1uM_wXk">this</a> Simple Sabermetrics video. wOBA measures the offensive production of a hitter similarly to on-base percentage, except that it weighs each outcome differently and accordingly. So, let’s add one last layer of complexity to our final expected statistic.</p><p>The <a href="https://www.mlb.com/glossary/statcast/expected-woba">expected weighted on-base average</a> formula takes the base of xSLG’s formula and adds two details that take its value to the next level: linear weights and all plate appearance outcomes.</p><blockquote><em>xwOBA = (</em><strong><em>uBB * wuBB + HBP * wHBP </em></strong><em>+ P(1B) * w1B + P(2B) * w2B + P(3B) * w3B + P(HR) * wHR) / (AB + </em><strong><em>BB + SF + HBP</em></strong><em>)</em></blockquote><p>That’s a lot to digest, so I bolded the pieces there that were not included from the xSLG formula, except for the “w” that prefixes each event. The “w” stands for weighted value. More on that can be found <a href="https://library.fangraphs.com/principles/linear-weights/">here</a>.</p><p>Unlike xBA and xSLG, xwOBA accounts for all plate appearances events, so it is able to measure the quality of contact <em>and</em> a batter’s other abilities to reach base or frequency to strike out. This crowns xwOBA as the most powerful measure of the three statistics, and is one of the reasons we chose to utilize the difference in wOBA and xwOBA as the luck factor in his recent video and why it is most prevalent on Savant’s leaderboards.</p><p>We spent the majority of this article from the hitter’s point of view, but these three expected statistics can be calculated for pitchers too. Finding their xwOBA against, for example, can more accurately describe the quality of contact (and non-batted ball success) that is being allowed over other basic metrics that are so volatile to variability and factors out of their control (defense, park, weather, etc.). So, let’s flip the coin and see which pitchers have had the most deviance from their expected performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*cnzCtLl67bDglFkduVHitA.png" /></figure><p>The styling is identical to the previous visualization; the x-axis is the actual performance and the y-axis is the expected. Because we’ve flipped to the other side of the ball, we have to adjust the lens in which we view these performances. A pitcher that allows a higher wOBA than xwOBA is suffering from poor luck and can be labeled as “underperforming.” Those with better luck — higher xwOBA than wOBA — are getting away with better outcomes than expected so are “over performing.” The former live below the red line and the latter above it, which is opposite from the hitters batting average graph. The likes of Jack Flaherty, Keegan Thompson, and Brett Anderson are out performing their expected weighted on-base average peripherals.</p><p>For those interested in learning more about the intricate details of Statcast’s xwOBA model, I highly recommend <a href="https://medium.com/@sam.sharpe/an-introduction-to-expected-weighted-on-base-average-xwoba-56e3fa6093cd">this article</a> written by a member of their research team, Sam Sharpe.</p><p><strong>Regressing to the Mean</strong></p><p>Because expected outcome statistics are a measure of player talent, a method to understand the usefulness of these metrics comes from <a href="https://www.baseballprospectus.com/news/article/41748/prospectus-feature-the-expected-contribution/">this article</a> from Baseball Prospectus writer, Jonathan Judge. Here’s a sentence from the article that is an important principle to understanding this concept.</p><p>“Principle 5: A player’s expected contribution cannot be directly measured; thus, it must be inferred from contribution measures evaluating descriptiveness, reliability, and predictiveness.”</p><p>A common misconception regarding expected statistics, like the ones we covered here, is that these measures are meant to be <em>predictive</em> of a player’s performance. We cannot say with confidence that a player will regress back to his expected performance just because his xBA is higher than his BA. It wouldn’t be a terrible guess, but there could be other factors contributing to the difference that is more stable over a season.</p><p>Instead, these metrics are meant to be <em>descriptive</em>, meaning that we’d expect the player’s expected statistics to correspond somewhat with the actual outcomes. That holds true among the three we explored. We were unable to scrape xSLG values from Savant, but we found that BA and xBA have a 0.799 R² value and wOBA and xwOBA have a 0.843 R², both very strong correlations.</p><p>A helpful anecdote to return to frequently is a batter going 0–4 during a game with four hard-hit outs who has a teammate that went 4–4 with three bloop singles and an infield hit. We also must be cautious of small sample sizes, but in this instance the player who went hitless displayed better skill without anything to show for it. This ties back to the luck factor of baseball. By using our expected metrics we gain a better idea for which of the two batters was more skillful during this game. This luck, or variability/randomness, will even out over the course of the season to a certain degree; the remaining difference between the expected and actual outcomes is what can be further explored by the excluded features: park factors, defensive positioning, weather conditions, and more.</p><p>Sharpe covers the reliability and predictability of xwOBA/xwOBACON in his article. He concludes that while these two metrics have relatively strong predictive power year-to-year (and first-half to second-half within a season), the marginal increase in correlation compared to their raw counterparts, wOBA/wOBACON, is not enough to use these metrics for predictions. Furthermore, barrel percentage has a higher correlation to the next year’s wOBACON, which proves additional support to this argument.</p><p>Expected outcome statistics were not designed to be predictive, as Sharpe and <a href="https://www.reddit.com/r/baseball/comments/n4scns/analysis_the_predictive_value_of_statcast/gx23hpo?utm_source=share&amp;utm_medium=web2x&amp;context=3">Tom Tango</a> point out. These statistics were designed to describe batter skill by focusing on what the batter can control: exit velocity and launch angle (and sometimes sprint speed). Without the likes of defensive positioning, park factors, or weather conditions, these are context-neutral statistics. By excluding these and ignoring context, we are able to measure the described player’s talent and compare players and events on even playing fields.</p><p><strong>Other Expected Metrics</strong></p><p>The sabermetric community may find a few other “expected” metrics familiar, such as xERA or xFIP. There’s also similarly named likelihood metrics like called strike probability or swinging strike probability. While these are calculated with vastly different formulas, the methodology of building a model trained on the truth ties the forever-known logical baseball ideas with statistical modeling to uncover new principles in baseball analytics.</p><p>These new principles have guided us since their introduction just a few years ago. The power of Statcast and other homemade sabermetrics continue to move the needle forward in our game. Using these expected statistics has given the baseball community another tool to identify under the radar players (or the opposite). xBA, xSLG, and xwOBA have made their home in the minds of eager baseball fans that have the same desire to understand why baseball acts the way it does sometimes. I wouldn’t be surprised to see these metrics eventually make their way onto the back of baseball cards. For now, let’s all rejoice at the scoreboards and TV broadcasts that showcase the expected batting average of a batted ball.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ecfab280eb8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Post-Game Pitcher Report with Statcast Data]]></title>
            <link>https://sambornstein.medium.com/building-a-post-game-pitcher-report-with-statcast-data-784257037fc1?source=rss-f8ed5128e71e------2</link>
            <guid isPermaLink="false">https://medium.com/p/784257037fc1</guid>
            <category><![CDATA[simple-sabermetrics]]></category>
            <category><![CDATA[shiny]]></category>
            <category><![CDATA[statcast]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[r-shiny]]></category>
            <dc:creator><![CDATA[Sam Bornstein]]></dc:creator>
            <pubDate>Mon, 15 Mar 2021 16:56:35 GMT</pubDate>
            <atom:updated>2021-03-15T16:56:35.759Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Note: This article was originally posted at </em><a href="https://www.simplesabermetrics.com/post/building-a-post-game-pitcher-report-with-statcast-data"><em>Simple Sabermetrics</em></a><em>. I post articles monthly on the Simple Sabermetrics blog and soon after re-post it here on my Medium account.</em></p><p>The ‘shiny’ package in the R programming language is a powerful tool to develop interactive web applications straight from your local RStudio. The package’s ease of use has made it a popular choice among programmers looking to naively explore application development. Since we covered the basics of ‘shiny’ in my <a href="https://www.simplesabermetrics.com/post/developing-an-r-shiny-application-with-statcast-data">last post</a>, this article will skip past the fundamentals. To date, we’ve covered data manipulation, data visualization, and shiny applications, which have laid a foundation to build a post-game pitcher report with Statcast data.</p><p>As we’ve done in previous posts, we will stick with the ‘NL_CY’ dataset that includes 2020 Statcast data from Trevor Bauer, Yu Darvish, and Jacob deGrom. As we dive deeper into building specific applications, the code is not as cut-and-dry to include all of it directly in this article. Instead, I’ll strongly encourage you to download the application’s code at this <a href="https://github.com/sambornstein/Simple-Sabermetrics/blob/main/R%20Shiny%20App/post_game_report_app.R">GitHub</a> link and follow along as I pinpoint and describe specific chunks of code.</p><p>As always, you can view the published application through my shinyapps account <a href="https://sambornstein.shinyapps.io/Simple_Sabermetrics_Post_Game_Report/">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HvBSE2CyblWVWp5JMXZBLQ.jpeg" /></figure><h3>User Interface (UI) Code</h3><h4>CSS Styling</h4><p>Cascading Style Sheets, otherwise known as CSS, is used alongside HTML and JavaScript as a mechanism to add style to web applications. The extent of CSS styling goes far beyond the examples provided in this post-game report. Read more about using CSS in shiny applications <a href="https://shiny.rstudio.com/articles/css.html">here</a> and <a href="https://engineering-shiny.org/css.html">here</a>.</p><pre>wellPanel(style = &quot;background: white; border-color: black; border-width: 2px&quot;, …)</pre><pre>hr(style=&quot;border-color: black;&quot;)</pre><p>The wellPanel() is the border you see around the report’s information. With no styling, the well panel has a grey background with an outline that is barely visible. To remove the grey background and increase the outline effect, I’ve applied the three CSS styles you see above.</p><p>The hr() is the horizontal line placed above the outlined report (not shown above). The default color is grey, so I’ve also changed the border color to black.</p><h4>Updating Select Inputs</h4><pre>choices = &quot;&quot;</pre><p>You might wonder why the choices for the select game input are left as blank quotations. This is intentional, and is done this way to allow the drop-down list of games to update based on the selected pitcher. We’ll cover this more in the “Observe Event” section down below.</p><h4>Text Outputs</h4><pre>h2(strong(textOutput(&quot;selected_pitcher&quot;)))</pre><pre>h2(textOutput(&quot;selected_game&quot;))</pre><p>The textOutput() function displays text generated from a specific input. This portion requires code written in the server, which is covered below in “Render Text.” I’ve also applied h2() to both the pitcher output and game output, which specifies the text as headers. h1() is the biggest header size, with the font decreasing as that number increases (h3, h4, etc.). Finally, strong() indicates that the text is bold.</p><h3>Server Code</h3><h4>Factor</h4><p>This chunk of code is actually a part of our “global code”, which is anything we execute before the ui and server sections. I’ve included it in this section of the article because it also could be placed in your server code.</p><pre>NL_CY$pitch_type &lt;- factor(NL_CY$pitch_type, levels = c(&quot;FF&quot;, &quot;SI&quot;, &quot;FC&quot;, &quot;CS&quot;, &quot;CU&quot;, &quot;KC&quot;, &quot;SL&quot;, &quot;CH&quot;, &quot;FS&quot;))</pre><pre>NL_CY$pitch_name &lt;- factor(NL_CY$pitch_name, levels = c(&quot;4-Seam Fastball&quot;, &quot;Sinker&quot;, &quot;Cutter&quot;, &quot;Curveball&quot;, &quot;Knuckle Curve&quot;, &quot;Slider&quot;, &quot;Changeup&quot;, &quot;Split-Finger&quot;))</pre><p>These two lines above are establishing an order for our “pitch_type” and “pitch_name” variables. The technical terminology is we are changing the order of levels for a factor. Both pitch variables are imported as character types. When a list of pitches is displayed in a table or plot legend, the order will be alphabetical, which sometimes isn’t desired.</p><h4>Observe Event</h4><pre>observeEvent(input$PitcherInput, <br>             updateSelectInput(session, <br>             inputId = &quot;GameInput&quot;, <br>             label = &quot;Select Game&quot;, <br>             choices = sort(unique(NL_CY$game_date[NL_CY$player_name == input$PitcherInput]))))</pre><p>As I alluded to above, this observeEvent() function updates the game input list with only the games in which the chosen pitcher appears in. You’ll notice “session” is included in this code. This chunk will not work unless “session” is included in your server function, as seen below.</p><pre>server &lt;- function(input, output, session) { … }</pre><p>An observeEvent() is a handy function to keep in your back pocket, especially once you start building more complex applications with more inputs. You can think of this function as a reaction between two events. If the user changes the input from the first event, there needs to be a reaction in the second input. In this case, when the pitcher changes, the dropdown list of games changes based on the new list of choices indexed in the updateSelectInput() function.</p><h4>Render Text</h4><pre>output$selected_pitcher &lt;- renderText({paste(input$PitcherInput)})<br> <br>output$selected_game &lt;- renderText({paste(input$GameInput)})</pre><p>As mentioned above, the selected pitcher and game date are displayed on the report through the code above. The renderText() function simply takes the input and connects through textOutput() to render on the interface.</p><h4>DT (Data Tables)</h4><p>I have yet to introduce data tables here at Simple Sabermetrics. Using the DT library, the datatable() function is used to output a basic-styled table displaying pitcher summary statistics. The input and output interact with renderDataTable() in the server and dataTableOutput() in the ui.</p><pre>output$pitcher_summary_table &lt;- renderDataTable({<br>  table &lt;- NL_CY %&gt;%<br>      ...<br>  tableFilter &lt;- reactive({table})<br>  datatable(tableFilter(), <br>            options = list(dom = &#39;t&#39;, <br>            columnDefs = list(list(targets = 0, visible = FALSE)))) %&gt;%<br>  formatStyle(c(1,2), `border-left` = &quot;solid 1px&quot;) %&gt;% <br>  formatStyle(c(2,5,7), `border-right` = &quot;solid 1px&quot;)<br>})</pre><p>Within the renderDataTable() code above, “table” is built using dplyr code (the entirety of the code replaced with “…” to save space). To allow for reactivity, the table is transformed to “tableFilter” to update with user input.</p><p>Additional styling is applied in the “options” argument, which removes the labeling surrounding the table, removes the row numbers, and adds column borders. Read more about the DT library <a href="https://rstudio.github.io/DT/">here</a>.</p><h3>Wrapping It Up</h3><p>All together, these bits and pieces round out a post-game report that includes information on the selected pitcher’s pitch metrics and performance, and visualizes each pitch’s movement, location, and velocity. By keeping the application to the size of one page, the inputs quickly turn into outputs.</p><p>Reports can vary in size and in the information they display. Hopefully this article’s post-game pitcher report gives you the means necessary to develop your own style of report with the information you and your team care about. Post-game reporting is fundamental to the data-driven feedback loop for athletes. The ‘shiny’ package makes it possible to utilize the basics of the R programming language to develop interactive web applications built for reporting.</p><p>I’ve written more on the types of reports my team and I put together at Iowa on my personal Medium blog. If you’d like to dig further into reports built in Shiny, be sure to check out these links: <a href="https://medium.com/iowabaseballmanagers/hawkdashboard-post-action-pitcher-reports-45139eda77de">Post-Action Pitcher Reports </a>&amp; <a href="https://medium.com/iowabaseballmanagers/hawkdashboard-blasttrax-reports-a2628ff0a1ca">BlastTrax Reports</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=784257037fc1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Developing an R Shiny Application with Statcast Data]]></title>
            <link>https://sambornstein.medium.com/developing-an-r-shiny-application-with-statcast-data-d267037d5a78?source=rss-f8ed5128e71e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d267037d5a78</guid>
            <category><![CDATA[shiny]]></category>
            <category><![CDATA[simple-sabermetrics]]></category>
            <category><![CDATA[statcast]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[r-shiny]]></category>
            <dc:creator><![CDATA[Sam Bornstein]]></dc:creator>
            <pubDate>Fri, 12 Feb 2021 15:49:39 GMT</pubDate>
            <atom:updated>2021-02-12T15:50:36.226Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Note: This article was originally posted at </em><a href="https://www.simplesabermetrics.com/post/developing-an-r-shiny-application-with-statcast-data"><em>Simple Sabermetrics</em></a><em>. I post articles monthly on the Simple Sabermetrics blog and soon after re-post it here on my Medium account.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*PYmeAp-mwV0f1NWxT77wyg.jpeg" /></figure><p>Within the R programming language is a package called ‘shiny’ that allows users to develop interactive web applications directly from the RStudio interface. If you’ve read some of my work on Twitter, LinkedIn, or my Medium blog, you might be familiar with my application, HawkDashboard. This application was built entirely from scratch with the ‘shiny’ library in R, as well as supporting packages that I will briefly touch on later.</p><p>Shiny applications can act as a one-stop dashboard for personal or public viewing. An application can vary in complexity; you can build a one-dimensional dashboard to automate plot or table generation, or set out to build a full-scale internal information system. At Iowa, HawkDashboard has proven to be a central location for all the data our staff collects, as well as a home for interactive player profiles, post-action reports, and statistics leaderboards.</p><p>In this article, I will take you through the steps to building a simple R Shiny application. Like we’ve seen in my previous blog posts on Simple Sabermetrics, we will be using Statcast data from the 2020 MLB season, specifically the three National League Cy Young finalists: Trevor Bauer, Yu Darvish, and Jacob deGrom. I covered how to filter data frames in this <a href="https://www.simplesabermetrics.com/post/statcast-data-manipulation-in-r">article</a>, but I have provided the ‘NL_CY’ CSV file on Github (link below). The content of the application we will create in this article will be using visualizations from the ‘ggplot2’ library, which I wrote about <a href="https://www.simplesabermetrics.com/post/statcast-data-visualization-in-r">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*poIPjzphR7YCNGluCPfQWw.png" /></figure><p>If you’d like to download the entirety of the R code for this article’s Shiny application, I have provided that <a href="https://github.com/sambornstein/Simple-Sabermetrics/tree/main/R%20Shiny%20App">here</a> in this Github folder. Finally, you can view this application publicly on my shinyapps account <a href="https://sambornstein.shinyapps.io/Simple_Sabermetrics_Statcast_App/">here</a>.</p><h3>Creating a Script</h3><p>Before we dive right into the code syntax, we will need to create a script by clicking the dropdown menu seen below and selecting “Shiny Web App”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/305/1*sxp7YymNe1vD26L_GVkG5A.png" /></figure><p>This will bring up the dialog box you see below. The “Application name” box is the name that will be given to the folder that houses the “app.R” script you create. You will choose a desired home for that folder by clicking the “Browse…” button. For now, we will only cover single file application types.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*Hnqgmc32V4QCte0GHWr96A.png" /></figure><p>Once you have completed these two steps, you should have a new R script that looks like a template for a Shiny web application. Next, let’s check the folder where the script was created. For me, this is where I created the “app.R” script for this application. The ‘NL_CY’ CSV file accompanies the script, as well as two folders — “rsconnect” and “www”. For now, ignore the former — this is an R generated folder that allows the user to publish applications to the web. The “www” folder was manually created and is where images (PNG or JPG) are stored to display in the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*lIO15QscS-UzmBEBDxr_2g.png" /></figure><h3>Necessary First Steps</h3><p>Now that you’ve got your Shiny script and folder directory squared away, it’s time to dive right into the code. Before we talk about the two main components of a Shiny script — ui and server — we must first load the required libraries and read in our data.</p><pre>library(shiny)<br>library(dplyr)<br>library(ggplot2)<br> <br>NL_CY &lt;- read.csv(&quot;NL_CY.csv&quot;)</pre><p>If you do not write the code for your libraries and dataset(s) at the top of your Shiny script, the app will not work correctly. Additionally, any transformations or additions to your dataset must be written at the top as well. You can consider this section your “global code”.</p><p>Before we continue any further, I should mention that the execution of the code for this article and supporting application is different from the previous two articles I’ve written on R code. Instead of following along and executing code line-by-line, you will have to have the entirety of the code written in one script and click the “Run App” button, as seen below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*mhBXqpAU3ZGH8osv3cDEBQ.png" /></figure><h3>Building the User Interface</h3><p>The user interface, referred to as the “ui”, is the section of your script to specify the layout of your application. If you are new to coding in Shiny, all of these functions should not be familiar to you. Rather than writing dplyr or ggplot2 code, we are using functions like fluidPage(), sidebarPanel(), and mainPanel() to piece together the aesthetic of a web page.</p><pre>ui &lt;- fluidPage(<br>  titlePanel(), <br>  sidebarLayout(<br>    sidebarPanel(),<br>    mainPanel()<br>  )<br>)</pre><p>This is close to the bare minimum needed to build a user interface. As you will see in the app.R script in the Github folder, I have the sidebarPanel() code filled in with the following…</p><pre>sidebarPanel(<br>    selectInput(<br>        inputId = &quot;PitcherInput&quot;, <br>        label = &quot;Select Pitcher&quot;, <br>        choices = sort(unique(NL_CY$player_name))),<br>    dateRangeInput(<br>        inputId = &quot;DateRangeInput&quot;, <br>        label = &quot;Select Date Range&quot;, <br>        start = min(NL_CY$game_date), <br>        end = max(NL_CY$game_date)),<br>    img(src = &quot;ss_logo.png&quot;, <br>        style = &quot;display: block; margin-left: auto; <br>                 margin-right: auto;&quot;, <br>        height = 150, <br>        width = 150)<br>)</pre><p>I have just introduced selectInput(), dateRangeInput(), and img(). These three inputs create a drop-down selection, date range selection, and an image, respectively. An input ID and label are required for the first two inputs, as well as designations for the inputs to interact with the connected dataframe. The pitcher input needs to know the list of pitchers, so those are determined in the “choices” argument. The date range input needs to know when to know a default start and end date, so those are denoted with arguments as well. In the end, this is what the sidebar panel looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*SJ1ieO8EZLGt1Plmy4HBSQ.png" /></figure><p>Off to the right of the sidebar panel is what is known as the main panel. As you will see in the app.R script in the Github folder, I have the mainPanel() code filled in with the following…</p><pre>mainPanel(<br>    tabsetPanel(<br>        tabPanel(&quot;Pitch Usage - Bar Chart&quot;, br(), <br>                 plotOutput(&quot;barchart&quot;)),<br>        tabPanel(&quot;Pitch Velocity - Box Plot&quot;, br(), <br>                 plotOutput(&quot;boxplot&quot;)),<br>        tabPanel(&quot;Pitch Velocity Trend - Line Plot&quot;, br(), <br>                 plotOutput(&quot;lineplot&quot;))<br>    )<br>)</pre><p>Within the panel I have included a tabsetPanel(), which is a string of tabs that divide output into a series of viewable sections (see below). You can create as many tabPanel() sections as you’d like, but within this application I limited myself to three. A br() denotes a line break, which was included to provide white space between the tab titles and plot outputs, which you will see all together here shortly. Finally, the plotOutput() functions take code from the server portion of the script to display</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*9SVAnffvgCeTQOLgaHyOrQ.png" /></figure><h3>Writing Server Code</h3><p>Now that the user interface has been set up, it’s time to piece together the other part of the puzzle in our server code. As I mentioned earlier, the server is where we will write the code for our visualizations, or any outputs for that matter. Below is close to the bare minimum needed to write server code.</p><pre>server &lt;- function(input, output) {<br>  output$plot1 &lt;- renderPlot({<br>    dataFilter &lt;- reactive({})<br>    ggplot()<br>  })    <br>}</pre><p>The ID for this hypothetical output is “plot1”. Inside renderPlot({}) is where code is written for the plot, as well as the reactive ({}) function to allow the plot output to update with input from the user interface. As you will see in the app.R script in the Github folder, each output is filled in with something of this nature…</p><pre>output$barchart &lt;- renderPlot({<br>    dataFilter &lt;- reactive({<br>        NL_CY %&gt;% <br>            filter(player_name == input$PitcherInput,<br>                   between(game_date, input$DateRangeInput[1],<br>                                      input$DateRangeInput[2])) %&gt;%<br>            group_by(pitch_name) %&gt;%<br>            summarize(&#39;count&#39; = n())<br>    })<br>    ggplot(dataFilter(), <br>           aes(x = reorder(pitch_name, -count), <br>               y = count, <br>               fill = pitch_name)) + <br>        geom_bar(stat = &quot;identity&quot;) +<br>        labs(x = &quot;Pitch Type&quot;, <br>             y = &quot;Count&quot;, <br>             title = &quot;Pitch Usage&quot;) +<br>        theme_bw() + <br>        theme(legend.position = &quot;none&quot;, <br>              plot.title = element_text(hjust = 0.5, <br>                                        face = &quot;bold&quot;, <br>                                        size = 16)) +<br>        theme(axis.title = element_text(size = 14), <br>              axis.text = element_text(size = 12))<br>}, width = 850, height = 450)</pre><p>The ID for this output is “barchart”. I created a reactive data frame called “dataFilter”. Again, a reactive data frame is one that updates with each change to the user inputs. If the data frame was not reactive, it would not change from the initial input selections. In addition to making the data frame reactive, I used some dplyr functions — similar to my data manipulation article — to create the new data frame.</p><p>Next, I take “dataFilter” and place it in ggplot() code below, but still within the renderPlot({}) parentheses. It’s important to note that there is a pair of parentheses placed immediately after “dataFilter” to maintain its reactive capability. If you forget to include them, a common error code you’ll get is “Error: object of type ‘closure’ is not subsettable.” Finally, between the final closing curly bracket and final closing parenthesis are definitions for the width and height of the plot. If done correctly, the following bar chart will populate in the Shiny app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WsOHB8XIpuKVj-r9igLR8A.png" /></figure><h3>Tying It All Together</h3><p>The very last component to a Shiny app is the shinyApp() function to collect the contents of both the ui and server to generate the resulting application.</p><pre>shinyApp(ui = ui, server = server)</pre><p>And there you have it. Those are the few main steps to creating a Shiny web application. While there are an endless number of potential additions, this article provides you the tools to create your own version of a dashboard, whether that’s with Statcast data or not. As I always like to do at the end of my Simple Sabermetrics articles, I have provided several links to helpful resources to grow your knowledge from here.</p><h3>Additional Resources</h3><p><a href="https://rstudio.github.io/shiny/tutorial/">https://rstudio.github.io/shiny/tutorial/</a></p><p><a href="https://shiny.rstudio.com/tutorial/">https://shiny.rstudio.com/tutorial/</a></p><p><a href="https://shiny.rstudio.com/tutorial/written-tutorial/lesson1/">https://shiny.rstudio.com/tutorial/written-tutorial/lesson1/</a></p><p><a href="https://www.r-bloggers.com/2019/12/r-shiny-for-beginners-annotated-starter-code/">https://www.r-bloggers.com/2019/12/r-shiny-for-beginners-annotated-starter-code/</a></p><p><a href="https://towardsdatascience.com/beginners-guide-to-creating-an-r-shiny-app-1664387d95b3">Beginner’s Guide to Creating an R Shiny App</a></p><p><a href="https://www.edureka.co/blog/r-shiny-tutorial/">https://www.edureka.co/blog/r-shiny-tutorial/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d267037d5a78" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Statcast Data Visualization in R]]></title>
            <link>https://sambornstein.medium.com/statcast-data-visualization-in-r-b2621a414ff3?source=rss-f8ed5128e71e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2621a414ff3</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[simple-sabermetrics]]></category>
            <category><![CDATA[statcast]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[ggplot2]]></category>
            <dc:creator><![CDATA[Sam Bornstein]]></dc:creator>
            <pubDate>Mon, 14 Dec 2020 17:05:09 GMT</pubDate>
            <atom:updated>2020-12-14T17:05:09.204Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Note: This article was originally posted at </em><a href="https://www.simplesabermetrics.com/post/statcast-data-visualization-in-r"><em>Simple Sabermetrics</em></a><em>. I post articles monthly on the Simple Sabermetrics blog and soon after re-post it here on my Medium account.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*H7cPFXnNhVpR9LMp6-Gy_w.jpeg" /></figure><p>In my last Simple Sabermetrics <a href="https://www.simplesabermetrics.com/post/statcast-data-manipulation-in-r">post</a>, I covered how to manipulate Statcast data using R. The goal of these posts is to help individuals learn important aspects of coding from the ground up, so we are going to build off the previous post in this one. If you’re just getting started, the data manipulation article is for you.</p><p>For this post we will be using the same data we used in the last post from Baseball Savant’s Statcast. This includes both the ‘NL_CY’ and ‘NL_ROY’ data frames that we created using the dplyr functions we learned about in that post, as well as new data frames we will create for the purpose of this article. Now we will take it a step further and dive in an aspect of baseball analytics that really interests me — data visualization!</p><p>Before we begin I would like to introduce the <a href="https://ggplot2.tidyverse.org/">ggplot2</a> package in R. This library is a data visualization package that makes complex plots easy to create. It is the most common data visualization package that the R community uses, which in turn makes it easy to troubleshoot errors and learn more about the extensions of the library.</p><p>I have provided the code in this article, but I have also packaged it into an R script on my <a href="https://github.com/sambornstein/Simple-Sabermetrics/blob/main/R%20Data%20Visualization/ggplot2%20Statcast%20Code.R">Github</a> (and the <a href="https://drive.google.com/file/d/1MSXAIU-FG2H0XmsBv7EACpKnq_6KFVXs/view">Google Drive</a> link for the CSV file). Feel free to download the script there to follow along. As always, please reach out with any questions. Let’s get started!</p><p><strong>Bar Chart</strong></p><p>The first visualization I want to start with is a bar chart. A bar chart is used to compare different groups or categories against a numerical value. In this example we will use the three 2020 Cy Young finalists and track the number of fastballs over 95 miles per hour for each pitcher.</p><p>This first chunk of code is the dplyr code necessary to manipulate the ‘NL_CY’ data frame to filter for each pitcher’s total number of fastballs thrown above 95. This code should look very familiar if you have read my previous article.</p><pre>FB_over_95 &lt;- NL_CY %&gt;%<br>  filter(pitch_type == &quot;FF&quot;) %&gt;%<br>  group_by(player_name) %&gt;%<br>  summarize(&#39;95+&#39; = sum(release_speed &gt; 95, na.rm = TRUE))</pre><p>Next, this chunk of code is an outline of the bare minimum code to create a bar chart with the newly created data frame. We use the ggplot() function to input the data frame name and variables to place on the x and y axes. The geom_bar() function is attached with a plus sign (+) to show a string of code linked together. The plot this creates is not shown in this article, but if you are curious to see what it looks like I encourage you to do it on your own or download the script from the Github linked above.</p><pre>ggplot(FB_over_95, aes(x = player_name, y = `95+`)) + <br>  geom_bar(stat = &quot;identity&quot;)</pre><p>Finally, multiple arguments are added to finalize the aesthetics of the visualization in the third chunk of code. This includes adding color to the bars, labels to the axes and plot title, altering the theme and removing the legend.</p><pre>ggplot(FB_over_95, aes(x = reorder(player_name, -`95+`), y = `95+`, fill = player_name)) + <br>  geom_bar(stat = &quot;identity&quot;) +<br>  labs(x = &quot;Pitcher&quot;, y = &quot;&quot;, title = &quot;Number of fastballs over 95 MPH&quot;) +<br>  theme_bw() +<br>  theme(legend.position = &quot;none&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*iENqMGppouv6nJZZGMB7Tw.png" /></figure><p>From this bar chart we can see that Jacob deGrom consistently threw faster than the other two finalists in the 2020 season. It’s one thing for a pitcher to have an average fastball velocity at or above 95 MPH, but to throw this many fastballs above that threshold is quite impressive.</p><p><strong>Density Plot</strong></p><p>After noticing that deGrom is far ahead of the other two, we can take this a step further and examine deGrom. If we wanted to see the distribution of deGrom’s fastball velocity, we would instead create a density plot to do this.</p><p>Similar to the previous section, the following code is the manipulated data frame to filter to just deGrom’s fastballs, a bare minimum outline of the density plot code, and the final version of ggplot code to create the visualization you see below.</p><pre>Fastballs_deGrom &lt;- NL_CY %&gt;%<br>  filter(player_name == &quot;Jacob deGrom&quot;, pitch_type == &quot;FF&quot;)</pre><pre>ggplot(Fastballs_deGrom, aes(x = release_speed)) +<br>  geom_density()</pre><pre>ggplot(Fastballs_deGrom, aes(x = release_speed)) + <br>  geom_density(color = &quot;red&quot;, fill = &quot;lightblue&quot;) +<br>  labs(x = &quot;Velocity (MPH)&quot;, title = &quot;Distribution of Fastball Velocity&quot;) +<br>  theme_bw()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*5pBN24nnI_MwuGGGnRP9LQ.png" /></figure><p>From this density plot we can gather that deGrom most commonly throws his fastball in the 98.5 to 99.5 MPH range, reaching up to almost 102 MPH as well.</p><p><strong>Box Plot</strong></p><p>A box plot is similar to a density plot in that it shows the distribution of values. The difference is that a box plot focuses on the minimum, first quarter, median, third quarter, and maximum values. It is also important to note that the data distribution is hidden in each box, compared to the density plot where you can see where the values most frequently occur.</p><p>In this box plot we will refer back to the three Cy Young finalists and measure the distribution of their fastball velocities. Yet again, Jacob deGrom consistently throws harder than the other two pitchers.</p><pre>Fastballs_NL_CY &lt;- NL_CY %&gt;%<br>  filter(pitch_type == &quot;FF&quot;)</pre><pre>ggplot(Fastballs_NL_CY, aes(x = player_name, y = release_speed)) +<br>  geom_boxplot()</pre><pre>ggplot(Fastballs_NL_CY, aes(x = player_name, y = release_speed, fill = player_name)) +<br>  geom_boxplot(width = 0.5) + <br>  labs(x = &quot;Pitcher&quot;, y = &quot;Velocity (MPH)&quot;, title = &quot;Distribution of Fastball Velocity&quot;) +<br>  theme_bw() +<br>  theme(legend.position = &quot;none&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*30c9_QKTxi-LvX5FXsQz7w.png" /></figure><p>From this box plot we can see the different ranges that each pitcher lives in with their fastball velocity. Instead of just looking at averages or maximums of velocity, we can truly see the ranges of values and percentiles.</p><p><strong>Scatter Plot</strong></p><p>For the past three visualizations we have focused on the distribution of the data and have not looked into the individual instances of each pitch. A scatter plot measures the relationship between two numeric variables. In this case, we are comparing Devin Williams’ pitch velocities to spin rate.</p><p>Since we are plotting each individual pitch of the data frame, there is no dplyr code needed to manipulate the data. The final chunk of code introduces new functions we have yet to see, so let’s quickly touch on them.</p><p>The scale_x_continuous() and scale_y_continuous() tell ggplot the limits of the x and y axes, as well as where to place the breaks on the axis. I chose to remove a couple of outliers and focus on where most of the data occurs, so this is why the code was inputted. Additionally, we increased the size of the individual instances by telling the geom_point() function the points should be size 2.</p><pre>ggplot(NL_ROY, aes(x = release_speed, y = release_spin_rate, color = pitch_type)) +<br>  geom_point()</pre><pre>ggplot(NL_ROY, aes(x = release_speed, y = release_spin_rate, color = pitch_type)) +<br>  geom_point(size = 2, na.rm = TRUE) +<br>  scale_x_continuous(limits = c(80,100), breaks = c(80,85,90,95,100)) +<br>  scale_y_continuous(limits = c(2000,3250), breaks = c(2000,2250,2500,2750,3000,3250)) +<br>  labs(x = &quot;Velocity (MPH)&quot;, y = &quot;Spin Rate (RPM)&quot;, color = &quot;Pitch Type&quot;,<br>       title = &quot;Devin Williams Velocity vs. Spin Rate&quot;) +<br>  theme_bw() +<br>  theme(legend.position = &quot;bottom&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*r30CRbWm5q-ZAph6HUxIMA.png" /></figure><p>If you aren’t familiar with “normal” spin rates for fastballs and changeups, keep in mind that Devin Williams changeup is a freak of nature. Comparing the relationship between velocity and spin rates in pitches is a common way to differentiate between pitch types. A scatter plot is the most common tool to compare relationships between numeric variables and will be shown frequently on this blog throughout the next few posts.</p><p><strong>Scatter Plot — Correlation</strong></p><p>A scatter plot can also be used to measure the correlation between two numeric variables. Similar to the previous example, we are plotting variables on the x and y axes. For this example we want to see how the velocity of a pitcher’s fastball affects their swinging strike percentage. From this correlation below we can see that there is a minor correlation between throwing hard and inducing more swing and misses. Click <a href="https://statisticsbyjim.com/basics/correlations/">here</a> to read more about correlation.</p><pre>cor_df &lt;- statcast_data %&gt;%<br>  filter(pitch_type == &quot;FF&quot;) %&gt;%<br>  group_by(player_name, pitch_type) %&gt;%<br>  summarize(&#39;n&#39; = n(),<br>            &#39;mean_release_speed&#39; = mean(release_speed, na.rm = TRUE),<br>            &#39;sw_str_percentage&#39; = sum(description %in% c(&quot;swinging_strike&quot;, &quot;swinging_strike_blocked&quot;))/n()) %&gt;%<br>  filter(n &gt; 100, mean_release_speed &gt; 85)</pre><pre>ggscatter(data = cor_df, x = &quot;mean_release_speed&quot;, y = &quot;sw_str_percentage&quot;, <br>          add = &quot;reg.line&quot;, cor.coef = TRUE, cor.method = &quot;pearson&quot;,<br>          conf.int = TRUE, add.params = list(color = &quot;red&quot;, fill = &quot;lightgray&quot;),<br>          xlab = &quot;Velocity (MPH)&quot;, ylab = &quot;Swinging Strike %&quot;, <br>          title = &quot;Correlation: AVG FB Velocity vs. Sw. Strike %&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*vmS2NQ0Xs4pIVNk2oc5kow.png" /></figure><p>This scatter plot looks slightly different than the previous one we covered, and that’s because it’s from a different package than ggplot2. This ggscatter package is a sister library and is most commonly used for this tool. Be on the lookout for these kinds of plots in articles that cover most statistical methods and baseball analytics.</p><p><strong>Line Plot</strong></p><p>A line plot is a scatter plot where the dots are connected to represent a trend or series of time. A time series plot is an excellent method to observe trends in athletes, and is a very critical tool used by a baseball analyst. In this example we are examining the average fastball velocity by game for our three Cy Young finalists.</p><p>The code below includes a data type transformation. We are transforming the “game_date” variable to show up as a date type, rather than a character type. This will allow us to graph a string of chronological dates on the x-axis.</p><pre>NL_CY$game_date &lt;- as.Date(NL_CY$game_date)</pre><pre>time_df &lt;- NL_CY %&gt;%<br>  filter(pitch_type == &quot;FF&quot;) %&gt;%<br>  group_by(player_name, pitch_type, game_date) %&gt;%<br>  summarize(&#39;n&#39; = n(),<br>            &#39;mean_release_speed&#39; = mean(release_speed, na.rm = TRUE))</pre><pre>ggplot(data = time_df, aes(x = game_date, y = mean_release_speed, group = player_name)) + <br>  geom_line() + geom_point()</pre><pre>ggplot(data = time_df, aes(x = game_date, y = mean_release_speed, group = player_name, color = player_name)) + <br>  geom_line(size = 1) + geom_point(size = 3) +<br>  labs(y = &quot;Velocity (MPH)&quot;, title = &quot;Average FB Velocity by Game&quot;, color = &quot;&quot;) +<br>  theme_bw() +<br>  theme(legend.position = &quot;bottom&quot;, axis.title.x = element_blank())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*1FPuPjEFlIxZ5XeACzRvXg.png" /></figure><p>Some observations we can make from this visualization are that Jacob deGrom (again) consistently throws hard, Yu Darvish saw a spike in velocity in late August, and Trevor Bauer saw a significant drop in velocity over the course of the first three games of the season.</p><p><strong>Wrapping It Up</strong></p><p>Data Visualization is a critical component to being a successful baseball analyst. Supplementing various analytic tasks with some sort of graph, chart, plot, or even table allows your intended audience — in this case a coach or staff member — the ability to better understand the message you are trying to communicate.</p><p>The R package used in this article — ggplot2 — is the most common library used in the R community. This means that there are an endless amount of resources to further develop your skills visualizing information in the R programming language. Here are a few resources to check out that have been particularly useful to me in the past.</p><p><a href="https://www.r-graph-gallery.com/">R Graph Gallery</a></p><p><a href="https://rstudio.com/wp-content/uploads/2015/03/ggplot2-cheatsheet.pdf">ggplot2 Cheatsheet</a></p><p><a href="https://uc-r.github.io/ggplot_intro">UC Tutorial</a></p><p><a href="http://r-statistics.co/Complete-Ggplot2-Tutorial-Part1-With-R-Code.html">R Statistics Tutorial</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2621a414ff3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Statcast Data Manipulation in R]]></title>
            <link>https://sambornstein.medium.com/statcast-data-manipulation-in-r-75210f00ab?source=rss-f8ed5128e71e------2</link>
            <guid isPermaLink="false">https://medium.com/p/75210f00ab</guid>
            <category><![CDATA[statcast]]></category>
            <category><![CDATA[data-manipulation]]></category>
            <category><![CDATA[simple-sabermetrics]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[dplyr]]></category>
            <dc:creator><![CDATA[Sam Bornstein]]></dc:creator>
            <pubDate>Sun, 15 Nov 2020 20:54:18 GMT</pubDate>
            <atom:updated>2020-11-15T20:54:18.239Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Note: This article was originally posted at </em><a href="https://www.simplesabermetrics.com/post/statcast-data-manipulation-in-r"><em>Simple Sabermetrics</em></a><em>. I post articles monthly on the Simple Sabermetrics blog and soon after re-post it here on my Medium account.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*gOoUYvLKMMGNyVB66eAOoA.jpeg" /></figure><p>The <a href="https://www.rdocumentation.org/packages/dplyr/versions/0.7.8">dplyr</a> package is the backbone of data manipulation in R. It is a simple, yet critical library that contains several useful functions for working with data frame-like objects.</p><p>For this article we will be using pitch-by-pitch Statcast data from the 2020 MLB season. This data was acquired from Bill Petti’s <a href="http://billpetti.github.io/baseballr/">baseballr</a> package. I have provided a <a href="https://drive.google.com/file/d/1MSXAIU-FG2H0XmsBv7EACpKnq_6KFVXs/view?usp=sharinghttps://drive.google.com/file/d/1MSXAIU-FG2H0XmsBv7EACpKnq_6KFVXs/view?usp=sharing">download</a> link for this data set, as well as a <a href="https://github.com/sambornstein/Simple-Sabermetrics/tree/main/R%20Data%20Manipulation">Github</a> R script with the code used to acquire the data. Additionally, there is an R script in the same folder with the exact code you will see in this post.</p><p>Inside the Statcast data set we will be focusing on this year’s National League Rookie of the Year and three Cy Young finalists: Devin Williams, Trevor Bauer, Jacob deGrom, and Yu Darvish, respectively. If you are a beginner level programmer in R, this article will give you the foundation to manipulate Statcast data to create meaningful data frames.</p><h3>Setup Your Workspace</h3><p>Before we jump into the exercise, let’s make sure your R Studio environment is ready to go. Once the dplyr package is installed (if it isn’t already), we will need to load the library, set our working directory, and import the Statcast data set. Here is the necessary code to do so.</p><pre>install.packages(&quot;dplyr&quot;)<br>library(dplyr)<br>setwd(&quot;~/<em>PATH TO FOLDER WITH CSV FILE&quot;</em>)<br>statcast_data &lt;- read.csv(&quot;mlb_2020_statcast_pitcher.csv&quot;)</pre><p>Each individual person’s working directory will be different, so this is where you would replace “PATH TO FOLDER WITH CSV FILE” with your personal computer’s path. This is the folder where your Statcast .csv file is located. For example, my file path is “~/BASEBALL/Simple Sabermetrics” because within my Documents folder I have a folder titled “BASEBALL” which holds my “Simple Sabermetrics” folder. If you have any trouble doing this, check out the R script on Github for assistance, or please reach out to me with questions! Without further ado, let’s begin.</p><h3>Filtering, Selecting, and Arranging Data</h3><p>First, we will want to filter our original dataset, ‘statcast_data’, to the desired players. In this exercise, we are going to create two separate data frames, ‘NL_ROY’ and ‘NL_CY’.</p><pre>NL_ROY &lt;- statcast_data %&gt;% <br>  filter(player_name == &quot;Devin Williams&quot;)</pre><pre>NL_CY &lt;- statcast_data %&gt;%<br>  filter(player_name %in% c(&quot;Trevor Bauer&quot;, &quot;Jacob deGrom&quot;, &quot;Yu Darvish&quot;))</pre><p>In the ‘NL_ROY’ data frame, we have filtered for just Devin Williams, telling the dplyr function that we want the “player_name” to exactly equal, ==, his name. Other the other hand, we want to filter for three different players in the ‘NL_CY’ data frame. To do this, we will use the %in% operator to tell the dplyr function that there are multiple values, and that list of pitchers are in a combined list, c(). If you have written code in the dplyr package previously, this setup should look familiar. If not, this is an organized way to keep your syntax consistent. Let me break this down for you.</p><pre>new_data_frame &lt;- old_data_frame %&gt;%<br>  dplyr function</pre><p>Thinking of the first two data frames we created, ‘statcast_data’ is the original data we imported, and ‘NL_ROY’ and ‘NL_CY’ are the newly created data frames. The dplyr function(s) follow in the subsequent lines of code, chained together by the use of the pipe operator: %&gt;%. As I like to call it, it is a comma on steroids.</p><p>Now that we have the basics covered, let’s continue with creating more data frames. The ‘NL_ROY’ data frame that we created contains 90 variables of data for each pitch Devin Williams threw in the 2020 season. 90 variables is a lot, and we often only need to focus on a few of them for certain tasks. Let’s choose just a handful of columns to look at.</p><pre>ROY_pitch_info &lt;- NL_ROY %&gt;%<br>  select(player_name, pitch_type, release_speed, release_spin_rate)</pre><p>The data frame this chunk of code creates also includes every pitch Williams threw in 2020, but it only returns the five columns we selected. What if we wanted to select more columns but did not want to type out the name of each variable?</p><pre>ROY_columns &lt;- NL_ROY %&gt;%<br>  select(player_name, pitch_type:release_speed)</pre><p>By using a colon between variable names instead of commas, the select() function returns the columns within that range. While this example only spans three columns, this can be applied to any length of variables across a data frame.</p><p>Taking a step back to the pitch info example, let’s add the arrange() function to sort the data to our liking. Let’s say we want to see the data ordered by pitch speed, with the fastest pitches at the top.</p><pre>ROY_release_speed &lt;- NL_ROY %&gt;%<br>  select(player_name, pitch_type, release_speed, release_spin_rate) %&gt;%<br>  arrange(desc(release_speed))</pre><p>Now let’s tie this section together through the use of all three dplyr functions we have learned about thus far: filter(), select(), and arrange().</p><pre>ROY_FF &lt;- NL_ROY %&gt;%<br>  select(player_name, pitch_type, release_speed, release_spin_rate) %&gt;%<br>  filter(pitch_type == &quot;FF&quot;) %&gt;%<br>  arrange(desc(release_speed))</pre><p>The prompt for this chunk of code is to display all four-seam fastballs for Devin Williams, sorted by pitch speed, and only showing his name, pitch type, pitch speed, and spin rate.</p><h3>Grouping, Summarizing, and Mutating Data</h3><p>Up until this point we have only worked with the existing data points in the data set, filtering to the desired pitchers or pitch types, selecting the columns we chose to look at, and arranging the order of the rows to our liking. In this next section we are going to create new columns with the group_by(), summarize(), and mutate() functions.</p><p>To begin, let’s tally the number of times Devin Williams threw each pitch type.</p><pre>ROY_pitch_count &lt;- NL_ROY %&gt;%<br>  group_by(pitch_type) %&gt;%<br>  summarize(&#39;pitch_count&#39; = n())</pre><p>Within the group_by() function we have chosen to group by the “pitch_type” variable. By using the pipe operator, we can then create a new variable, “pitch_count”, within the summarize() function. Below is the proper syntax for creating new columns.</p><pre>summarize(&#39;<em>COLUMN NAME</em>&#39; = <em>FUNCTION</em>())</pre><p>Some possible functionalities include mean(), median(), min(), max(), n(), etc. The n() function counts the number of instances and is very commonly used. Let’s run through a few more examples.</p><pre>ROY_avg_velos &lt;- NL_ROY %&gt;%<br>  group_by(pitch_type) %&gt;%<br>  summarize(&#39;pitch_count&#39; = n(),<br>            &#39;average_velocity&#39; = mean(release_speed, na.rm = TRUE))</pre><pre>ROY_range_velos &lt;- NL_ROY %&gt;%<br>  group_by(pitch_type) %&gt;%<br>  summarize(&#39;pitch_count&#39; = n(),<br>            &#39;min_velocity&#39; = min(release_speed, na.rm = TRUE),<br>            &#39;max_velocity&#39; = max(release_speed, na.rm = TRUE))</pre><p>Calculating the mean, minimum, and maximum of a grouped variable is quite common in data manipulation. These three functions barely scratch the surface of what can be used to create new columns.</p><p>This next chunk of code ties together multiple pieces we’ve touched on already, but the focus here is on the mutate() function. Mutate() is different from summarize() in that it changes an existing column rather than focusing on a single group. Let’s use this function to calculate Bauer Units for each of the three pitchers in the ‘NL_CY’ data frame.</p><pre>CY_FF_ranks &lt;- NL_CY %&gt;%<br>  filter(pitch_type == &quot;FF&quot;) %&gt;%<br>  group_by(player_name, pitch_type) %&gt;%<br>  summarize(&#39;average_velocity&#39; = mean(release_speed, na.rm = TRUE),<br>            &#39;average_spin&#39; = mean(release_spin_rate, na.rm = TRUE)) %&gt;%<br>  mutate(&#39;bauer_units&#39; = round(average_spin/average_velocity,1))</pre><p>Let’s walk through this one. First, we will filter the data frame to only include four-seam fastballs. Second, we form our group on the pitchers and pitch type, which at this point is a little redundant, but we will do so anyways. Next we re-create the “average_velocity” column and add in “average_spin” as well. Finally, using the mutate() function we can perform a calculation on two existing columns — “average_velocity” and “average_spin” — to create the “bauer_units” column.</p><h3>Wrapping It Up</h3><p>These six functions (filter(), select(), arrange(), group_by(), summarize(), and mutate()) are the foundation of the dplyr package, but only a fraction of what the library has to offer. Data manipulation is a necessary first step in the process of analyzing baseball data. Not often will you be presented with a data set that is tailored exactly to your needs. Pitch-by-pitch Statcast data has a lot to offer, but can be an intimidating data set at first glance. Manipulating this data with the dplyr package is the first step in the right direction towards analyzing baseball data.</p><p>In my next post I will be moving on to data visualization in the <a href="https://ggplot2.tidyverse.org/">ggplot2</a> library. We will mostly work off the information from this post, but I would love to hear some feedback on what you would like me to cover. If you found this post helpful, want to see what other data manipulation is possible with Statcast data, or have requests for my next post, please leave a comment or reach out to me via <a href="https://twitter.com/Sam__Bornstein">Twitter</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75210f00ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting Started In Baseball Analytics]]></title>
            <link>https://sambornstein.medium.com/getting-started-in-baseball-analytics-b8cb9de312a9?source=rss-f8ed5128e71e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8cb9de312a9</guid>
            <category><![CDATA[simple-sabermetrics]]></category>
            <category><![CDATA[baseball-analytics]]></category>
            <category><![CDATA[python-vs-r]]></category>
            <dc:creator><![CDATA[Sam Bornstein]]></dc:creator>
            <pubDate>Thu, 22 Oct 2020 18:11:04 GMT</pubDate>
            <atom:updated>2020-10-22T18:11:04.870Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Note: This article was originally posted at </em><a href="https://www.simplesabermetrics.com/post/getting-started-in-baseball-analytics"><em>Simple Sabermetrics</em></a><em>. I will be publishing a post on that blog every month and will soon after re-post it here on my Medium account.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*nJbmAvKpxCGy6A_6FipM-Q.jpeg" /></figure><p>In my last <a href="https://www.simplesabermetrics.com/post/data-driven-decisions">post</a>, we learned that making informed decisions through the use of data increases your chances of success. We covered the new era of baseball technology, a specific example of a pitcher going through the pitch design process, and most importantly — how to apply data to drive these decisions. This week, I want to take a step back and lay out the resources that are out there to equip you with the right tools to analyze baseball data.</p><h3>Resources</h3><p>Whether you are a high school student, college freshman, or a long-time baseball coach, there is no better time to pick up coding. There’s no blueprint for adding a programming language to your toolbox; I found myself coding through the help of co-workers and effectively manipulating my Google searches. At first glance the syntax can be daunting, but once you get comfortable with the language, you’ll be glad you started.</p><p>For those college students that are reading this, the first resource I’d recommend you take advantage of is your school’s curriculum. If you are working towards a degree in analytics, statistics, computer science, or any related field this shouldn’t be a problem for you. If you’re working towards a different degree, talk to your advisor to see which classes you can enroll in to pick up these skills. Additionally, <a href="https://www.linkedin.com/learning/">LinkedIn Learning</a> might be discounted or accessible for free, depending on your university. As for high school students, it may be tougher to find a class with a similar curriculum. In that case, other resources come into play.</p><p><a href="https://www.datacamp.com/">DataCamp</a> is a common structured online learning resource that allows users to interact with courses, practice modules, projects, and assessments. <a href="https://www.codecademy.com/">Codecademy</a> is another online resource that has similar structured learning courses. These websites offer the first few lessons of their chapters for free, with the option to pay for a subscription to access the rest of their courses. In addition to these two, there are a myriad of other websites, such as <a href="https://www.coursera.org/">Coursera</a>, <a href="https://www.edx.org/?g_acctid=926-195-8061&amp;g_campaign=new-gs-us-brand-core-exact&amp;g_campaignid=1661780380&amp;g_adgroupid=62996189654&amp;g_adid=320490842380&amp;g_keyword=edx&amp;g_keywordid=kwd-89882436&amp;g_network=g?utm_source=adwords&amp;utm_campaign=1661780380&amp;utm_medium=62996189654&amp;utm_term=edx&amp;gclid=CjwKCAjw5p_8BRBUEiwAPpJO63ZWE6XOrlibGgqEfi8Y_tuBCbVFaFN2JwVTWiSX-3TfNV_f8OyA8xoClhoQAvD_BwE">edX</a>, and <a href="https://www.udemy.com/">Udemy</a>.</p><p>Only a couple of these websites offer unique baseball analytics-styled courses, so it may be difficult to apply the information back to the baseball world. Fortunately, there is a book available titled, ‘<a href="https://baseballwithr.wordpress.com/about/">Analyzing Baseball Data with R</a>’. This book provides an introduction to R for those interested in exploring the rich sources of baseball data. This is a great spot to start for individuals who don’t need as much structure as an online class or a college-level course.</p><p>Finally, there is an even less structured format of learning code that may interest some, especially due to the low price of $0. A simple “how to code in R/Python” search into YouTube or Google will lead to <em>hundreds </em>of results. You may even become overwhelmed with the amount of options you have. This method requires a bit of trial and error, but is a completely practical method of equipping yourself with the proper skills. Overall, there are a ton of options out there, whether free or not. My best advice is to take advantage of the resources available to find what works best for you.</p><h3>Choosing a Programming Language</h3><p>R and Python are among the most popular programming languages that baseball analysts choose to perform data visualization, statistical analysis, and machine learning tasks. Let’s run through some details on each of the two:</p><p>R specializes in statistical analysis and data handling, visualization, and reporting. It has less use in advanced engineering and computing areas. This combination of functionalities best suits those who prefer an environment crafted specifically for data analysis and visualization.</p><p>On the other hand, Python is useful throughout the entire data analysis process and is well suited for advanced engineering and computing. This program is not as rich in cutting-edge libraries for statistical analysis and visualization. This combination of functionalities best suits those who prefer a more traditional programming language with a focus on machine learning and desire to integrate with other tools.</p><p>Each language has their strengths and weaknesses but at the end of the day I believe that someone looking to learn to code is best off by learning the language that best fits their needs. There is no wrong path to take when choosing between the two. The more time you take to decide, the less time you have to become an expert in one. For an in-depth examination on R vs. Python for those looking to enter the baseball industry, check out <a href="https://www.youtube.com/watch?v=gNGuqCUgCaU">this video</a> from the Driveline Research &amp; Drinks podcast.</p><h3>Personal Experience</h3><p>How did my path to a data analyst begin? Luckily, I’ve known the path I’ve wanted to take my career since the end of high school. Shortly after choosing to attend the University of Iowa, I reached out to the baseball program’s Director of Operations to ask about available student manager positions at the beginning of my Freshman year.</p><p>I interviewed and received a position on the manager staff during my summer orientation heading into the school year. My first year on the staff included responsibilities of a traditional college baseball student manager: organizing and assisting with drills, flipping baseballs underhand to hitters in the cages, playing catch with pitchers, completing scouting reports, etc. There was one piece of the puzzle missing that I wanted to get involved with — utilizing the data that our team was collecting.</p><p>At the time, our program was using Trackman and HitTrax (later on we would see the additions of other pieces of technology). I was fascinated by the data Trackman was collecting, but really didn’t get hands-on with the information until the following school year. With the addition of new managers my second year, I was able to slightly reduce my time at practice and work on adding a new skill to my toolbox — coding. With the help of another analytically-minded manager, YouTube, and Google searches, I started to pick up basic level skills in R.</p><p>These skills evolved over the course of my Sophomore year into my Junior year where I began to churn out post-game reports and put together small projects focused on certain aspects of a player’s development. At this point, my focus had shifted away from offering a helping hand at practice to putting in hours inside the office. My initial focus lied within setting up a structure for organizing the process of data collection, data analysis, and data application. One creation that made an impact in this process was Iowa’s current internal information system, HawkDashboard. Working to develop this application expanded my skill set and effectively set me up to bring in three new student managers to strictly work with data analysis.</p><p>This newly-founded analytics department marked the beginning of my fourth year in the program. Our staff worked together on a daily basis to solve baseball research questions and put together unique projects to advance our analytical capability. This group of analysts solidified my hypothesis of “learning by doing.” While this method was critical to the beginning stages of my coding abilities, I do credit the rest of my learning to my undergraduate experience.</p><p>As a Business Analytics student, I was required to enroll in several business-type classes such as marketing, accounting, management, etc. While I took away valuable skills from these classes, I found myself wanting more. If there was a Baseball Analytics 101 course offered, I would have taken it each semester, twice. Unfortunately, that is not often the case. Since the analytics and coding classes did not come until my Junior year, I was forced to “learn by doing” outside of class to pick up that level of knowledge to complete baseball research projects. Fortunately, this allowed me to excel in my classes and add additional structure to my abilities. Now as a graduate student, my course load focuses entirely on these types of classes. I am able to dive further into the weeds with my work and bring those on-campus resources to help myself and my analytics team grow as baseball analysts.</p><h3>Wrapping It Up</h3><p>If you are reading this article because you are looking to analyze baseball data, there are a few key points I want you to take away:</p><ol><li>There are endless resources out there to get started</li><li>There is no right or wrong programming language to choose</li><li>There is never a better time to start coding</li></ol><p>If this article helps at least one person choose the right direction to start analyzing baseball data, then I’ve done my job. In future articles I plan to continue off of this topic by providing real-world applicable baseball code to solve different problems and visualize different information. We will cover how to create baseball-specific visualizations such as pitch movement plots, spray charts, and more!</p><p>If you have any further questions about what we covered in this article, do not hesitate to message me on <a href="https://twitter.com/Sam__Bornstein">Twitter</a> or <a href="https://www.linkedin.com/in/sambornstein/">LinkedIn</a>. Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8cb9de312a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>