Measure Batting with On-Base Percentage
Use on-base percentage as a simple measurement of a player’s offensive contributions.
Batting average is easy to calculate, but its meaning is actually kind of complicated. It ignores important offensive contributions (walks) and it doesn’t count sacrifices. Many baseball fans think that another statistic, on-base percentage (OBP), is a much better representation of hitting ability.
OBP is a measure of how many times a player makes it on base, whether he makes it on base through a hit (H), is awarded a walk (a base on balls, or BB), or is hit by a pitch (HBP). For batting average, we exclude walks, hits by pitches, and sacrifice flies (SF), but for OBP, we include all of these. The formula for OBP is a little more complicated than the formula for batting average:
OBP = (H + BB + HBP) / (AB + BB + HBP + SF)
However, I think its meaning is clearer. There are no caveats; it’s just the percentage of time the player reaches base.
Sample Code
Here’s the simple way to calculate OBP, if you have already loaded the Baseball Archive data into R:
attach(batting) batting$OBP <- (H + BB + HBP) / (AB + BB + HBP + SF)
As I explain in “Measure Batting with Batting Average” [Hack #40] , I use a slightly more difficult method of calculation. Basically, I calculate the average number of games a player’s teams played (when the player played on more than one team), and the total statistics for a player for a whole season. This lets me correctly calculate statistics ...
Get Baseball Hacks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.