Skip to content
Can xBA Predict Change in Batting Average?
Project
Can xBA Predict Change in Batting Average?
Source
MLB StatCast Data
Objective
Determine whether MLB StatCast’s xBA (Expected Batting Average) metric was able to successfully predict changes in batting average between the 2023 All-Star Break and the end of the 2023 Regular Season.
What is xBA?
- xBA is similar to BA (Batting Average), but with a unique twist. Instead of accounting for the actual result of the play, xBA calculates each batted ball’s probability of being a hit based on exit velocity and launch angle.
- Regardless of actual batting average, xBA determines how frequently a batter would typically get a hit based on average quality of contact.
What does it mean if a batter's xBA is higher/lower than his BA?
- If his xBA is higher than his BA, that would mean he’s making lots of quality contact that is resulting in outs, or he is a rather “unlucky” hitter.
- If his xBA is lower than his BA, that would mean he’s making lots of poor contact that is resulting in hits, or he is a rather “lucky” hitter.
- Download MLB StatCast data to include player name, player ID, at-bats, batting average, and xBA, both during the All-Star Break and after the end of the Regular Season. Import data with Python, full join both data sets, and drop rows with null values. Export new dataset as CSV to analyze on PowerBI.
#import package
import pandas as pd
batter_asg = pd.read_csv("batters_asgbreak.csv")
batter_eos = pd.read_csv("batters_endseason.csv")
batter = batter_asg.merge(batter_eos, on = 'player_id', suffixes = ('_asg', '_eos'))
batter.dropna()
batter.to_csv('batter.csv', index=False)
- Using PowerBI, filter the data to only include MLB players who had a minimum of 100 at-bats before the All-Star break and 50 at-bats after the All-Star Break. Create an "xBA - BA" column that calculates the difference between every players xBA and BA at the All-Star Break. Create a "Change in BA" column that calculates the increase or decrease in batting average between the All-Star Break and the end of the Regular Season. Create a PowerBI report consisting of multiple visualizations showcasing how disparities between xBA and BA can forecast a change in batting average.
According to this season’s data, xBA does a fairly good job of predicting batting average! Players’ xBA at the All-Star break successfully predicted an increase or decrease in most batting averages through the rest of the regular season…
- 59% of all batting averages (minimum 100 at-bats before All-Star break and 50 at-bats after All-Star break)
- 66% when xBA was .010 more or less than Batting Average
- 71% when xBA was .020 more or less than Batting Average
- 84% when xBA was .030 more or less than Batting Average