Do lefties hit better against righties (and vice versa)?
In the 1950s, Branch Rickey’s Dodgers pioneered a lot of baseball thinking, including "platoon effects.” Based on observations that lefthanded batters fared better (on average) when facing righties than lefties, the Dodgers began to change pitchers and batters to better fit their opponents.
This hack looks at this classic sabermetric effect, showing you how to measure the effect of handedness.
Let’s start by looking at how lefty and righty hitters fared, on average, against lefty and righty pitchers over the past year.
To run these queries, you’ll need a play-by-play database such as the one I created in “Make a Historical Play-by-Play Database” [Hack #22] . You’ll also find it helpful to index the play-by-play tables by hand so that the queries run quickly. You can do this by executing the following SQL commands through your SQL client:
-- create an index to expedite processing create index pbp2k_hands_idx on pbp.pbp2k (res_batter_hand, res_pitcher_hand, res_batter, res_pitcher);
Now, let’s look at how players do by hand. Here is a query that calculates league batting averages and league average on-base percentage for each combination of batter and pitcher hand. I used a subquery to make this easy to read. The subquery calculates H, AB, BB, HBP, SF, and SH for each play. The main query calculates the league averages of these amounts.
select res_batter_hand, res_pitcher_hand, ...