Showing posts with label New York Yankees. Show all posts
Showing posts with label New York Yankees. Show all posts

February 24, 2013

MLB runs allowed by team

Or, How good were the Maddux/Glavine-era Braves?

In this on-going series of posts about run scoring in Major League Baseball, for this installment I'll turn the equation around and look at runs allowed.  In order to account for the changing run scoring environments, the runs allowed by individual teams is compared to the league average for that season, creating an index where 100 is the league average. In this formulation, a score below 100 is a good thing; a team with an index score of 95 allowed runs at a rate 5 percentage points below the league average.

Having written the original code in R, it's now a very simple process to change a few variable names and create the equivalent of the earlier runs scored analysis, but looking at runs allowed. This is one of the most important benefits of a code/syntax environment, an option that doesn't exist if  you are using a point-and-click GUI interface.

February 17, 2013

Run production, one team at a time


In a previous post, I used R to process data from the Lahman database to calculate index values that compare a team's run production to the league average for that year.  For the purpose of that exercise, I started the sequence at 1947, but for what follows I re-ran the code with the time period 1901-2012.

The R code I used can be found at this Github gist. Instead of boring you here with the ins and outs of what the code is doing, I've embedded that as documentation in the gist. The R code assumes that you've got a data frame called "Teams.merge" already in your workspace.  This can be achieved by running the previous code, or if you've done that before, you'll have created a csv file with the name "Teams.merge.csv", and now have the option to read that file as a data frame "Teams.merge".

The first step is to choose one of the current teams, and create a data frame that contains just that club's history.  Once this has been done, the code then creates trend lines (using the LOESS method, as I did with the leagues in previous posts), and then plot them.

October 7, 2011

WPA contribution infographic

I like these WPA word cloud graphics from SB Nation by Kevin Dame, describing the player contributions in last night's Tiger-Yankee ALDS game 5.  (From
http://mlb.sbnation.com/2011/10/7/2474640/yankees-tigers-game-5-visual-box-score.)






One of the things I like is that they emphasize that that WPA (Win Probability Added) is circumstantial. 

For the Tiger pitching staff, the starter Fister gave up only one run over five innings (that is, four scoreless innnings), but gets a smaller font than the closer Valverde who worked only the scoreless ninth inning.  An easy example is Fister worked a 1-2-3 1st innning with a 2-0 lead, which was worth 0.052 WPA.  By contrast, Valverde's 1-2-3 9th inning with a one-run lead (3-2 score), was worth 0.222 WPA.  Being later in the game and with a tighter score yielded a higher WPA.

And for the Yankee hitters, ARod's strikeout to end the game (the end of Valverde's 1-2-3 ninth) was only one-third as important to the Yankee defeat (-0.053 WPA) as Swisher's strikeout to end the 7th inning, when the bases were loaded (-0.154).  Of course, on Swisher's strikeout Tiger pitcher Joaquin Benoit set himself up for the big 0.154 WPA by coming in with a runner on 1st, then giving up two singles to load the bases, followed by a walk to close the lead to one run.

(The Fangraphs box score has the details that were used to make the word clouds, while the individual play log, with the WPA for each at-bat, is here.)

-30-