Wednesday, January 16, 2019

How did Bobby Abreu Perform in Clutch Situations????

Was Bobby Abreu clutch?

If you did not live in the sports vacuum of Philadelphia you would never understand why I would even bother writing this.  If you do happen to live within the Philadelphia sports world, it makes perfect sense. 
During his tenure in Philadelphia, Bobby Abreu was criticized for a lack of hustle, awful defense (despite winning a Gold Glove), and for not being clutch.  The last campaign being paraded most by the villain of Philadelphia sports media, Howard Eskin.  When Abreu was traded for a package of underperforming and long shot prospects, many looked to Eskin and the Phillysports media for drawing such negative attention to the player.  





I am not the first person to go on this endeavor either, questioning the conventual wisdom of the Philadelphia sports talkers surrounding Abreu.  A quick google searched showed a goodphightblog from 2006 using SQL and a blog from an economics professor. 

Before I get the analysis started, just one disclaimer.  I am not going to infer where clutch stats mean anything, whether they are statistically significant from stats in a normal situation, or if some players have some clutch advantage.  I am merely testing if the Philly sports media talk was right about Bobby Abreu.  Personally, I believe any sort of “clutch” ability is a statistical anomaly or a product of human observation bias (ex. “I watched baseball player X hit a walk off homerun last year so he must be clutch.”

What is clutch??
              To start, what exactly is clutch??????  It depends who you ask.  I will try to entertain multiple definitions.  For example, the Elias Sports Bureau once defined it as “any at-bat in the seventh inning or later, with the batter's team trailing by three runs or less (or four runs if the bases were loaded).  Also, I will look at a clutch situation when a runner is in scoring position.

Dplyring the data and getting the table we need
To answer the clutch questions, the answer will rely on taking large play by play data sets and filtering them to only match the specific criteria.  I will use JimAlbert’s shortcut to make life easier on myself.  I will read in data from 1998-2011, the heart of Abreu’s career, and then filter them based on his player ID. 
So for the actual method to this, its kinda messy.  First, I read in the data.  This involves reading in all the event files from 1998-2011.  Then I end up with a bunch of large dataframes with many ABs we don’t care about.  I then write a single function so that only Abreu is included (note I have not named the columns and I am still using Abreu’s retro ID.  I can fix this later but for now I will deal with it until the data is clean)



abreu <- function(x) {
  filter(x, X11 == "abreb001")
}

#I then made a career log by binding all these datasets.
career <- rbind(abreu1998, abreu1999, abreu2000, abreu2001, abreu2002, abreu2003, abreu2004, abreu2005, abreu2006, abreu2007, abreu2008, abreu2009, abreu2010, abreu2011)


The next challenge is dealing with clutch situations, I need to filter to where the score differential was -3:0 or -4 if the bases were loaded and it was the seventh inning or later.  I will start with the score.  The way the dataframe is set up there is a small problem.  Because it presents the score gives “home score” and “away score”.  You cannot just subtract home and away score because sometime you would be home while other times you would be away.  So I wrote a set of functions based on the Away team ID and the team that Bobby Abreu would have been played on.  


#these functions create a variable that creates the score differential
# of the team abreu was on.
phifunc <- function(x) {
  mutate(x, score=if_else(X2 == "PHI", (X9 - X10), (X10- X9)))
}
nyyfunc <- function(x) {
  mutate(x, score=if_else(X2 == "NYY", (X9 - X10), (X10- X9)))
}
laafunc <- function(x){
  mutate(x, score=if_else(X2 == "LAA", (X9 - X10), (X10- X9)))
}


Now I have a massive dataset with the score column added.  Now let’s make this truly clutch and filter it for the specific conditions.  To reiterate again the clutch situation is down by 3 or less in the 7th inning or later or down by 4 with the bases loaded.  I wanna splice this into three different situations to compare.  The non-clutch situation, the clutch situation, and the clutch and runners-in-scoring-position situation.    

#make a dataframe for not clutch situations
not_clutch <- career %>%
  filter((INN_CT < 7 & BAT_EVENT_FL == TRUE) | ((score < -4 & BAT_EVENT_FL == TRUE) | score > 1 & INN_CT > 6 & BAT_EVENT_FL == TRUE))

#make a dataframe for clutch situations
clutchcareer <- career %>%
  filter((score > -4 & score < 1 & INN_CT > 6 & BAT_EVENT_FL == TRUE) | (score == -4 & !is.na(BASE1_RUN_ID) & !is.na(BASE2_RUN_ID) & !is.na(BASE3_RUN_ID) & INN_CT > 6 & BAT_EVENT_FL == TRUE))
#lets look at clutch plays when men were on base
clutch_risp <- clutchcareer %>%
  filter(!is.na(BASE2_RUN_ID) | !is.na(BASE3_RUN_ID))

#I then had to summarize everything into little tables and join them with the event codes table.

#how did Abreu perform in nonclutch situations
cnt_not_clutch <- not_clutch %>%
  group_by(EVENT_CD) %>%
  count()
#join with the event codes table
cnt_not_clutch <- right_join(event_codes, cnt_not_clutch, by= "EVENT_CD")
cnt_not_clutch <- select(cnt_not_clutch, EVENT_CD, event, n)


The result ends up being this:



I then performed this for all the different situations.  I then had to create another table to compare all the situations, as well as the total.  Using the tribble function, I received this as a result:

Important to note, ‘RISP’ is a subset of ‘Clutch’ and 'Non-Clutch'.  If you were to add the rows, they would then be greater than ‘Total’.


Analysis of the Result

              PAs and ABs
·       As one would expect, most of Abreu’s at bats during this period were non-clutch.  His AB/PA ratio was higher in clutch and risp situations because he was more likely to get walked in those situations.

BA, OBP, SLUG, OPS
·       Interestingly, Abreu’s batting average in clutch situations was actually higher than non-clutch and the total, and interestingly c&r as well.  However, by only .009 pts, I doubt its significant.
·       Looking at OBP, there is a clear trend in clutch and risp situations.  Too put it simply, he was walked a lot.  His OBP is nearly .040 higher in clutch situations than non-clutch and .090 points higher in risp situations than non-clutch.
·       His slugging percentage does not seem to be significantly different in any situation, although slightly lower in risp. 
·       As a result of a high OBP, his OPS is more than .050 points higher in clutch and risp situations than in a non-clutch situation.  It is worth to note, in all situations Bobby Abreu’s OPS is exceptional and on par with a perennial All-Star and Hall of Famer.
BBs
·       By far the most significant factor in the difference between Abreu’s walk and clutch and non-clutch numbers were his increase in walks in clutch situations.  This makes sense, in these situations pitchers were afraid of Bobby Abreu and would father put him on base than give him something to hit.  In non-clutch situations, Abreu was only walked 14.2% of the time.  In clutch situations it went up to 18.3% and in risp situations it was 25.7% with more than half of those walks being intentional.  Although Philly broadcasters may have thought Abreu was a bum in clutch situations, pitchers were certainly not in agreement.

Conclusion
Although Bobby Abreu’s only significant difference in a clutch situation as opposed to a non-clutch situation was his higher rate of walks, this effectively disproves any notion that he was not a clutch hitter.  While I believe the characteristic of being “clutch” likely does not exist, Bobby Abreu hit just as well in clutch situation as non-clutch and that is a pretty good statistic.  I am sure any manager would be fine with a baseball player hitting his total average in any situation when they post numbers like .293/.405/.481.  
Let us all forgive Abreu from any damning accusations from Philly sports media and recognize him for his HOF level career.

Visualizations

Humans are visual creatures. Lets use some ggplots to take a look at how Abreu performed in certain events.



This of course is not readily by humans because field outs occur at such a higher rate than any other event.  The way to solve this is to scale everything down to logarithms.

The log count of each event happening in a non-clutch situation


The log count of each event happening in a clutch situation.


The log count of each event happening in a RISP situation.



Hitting Statistics Across different situations.

Lebron James, the forecasted GOAT????

          On November 14th, 2018 in a game against the Portland Trailblazers, Lebron James tied then passed Wilt Chamberlain to become 5th all time in scoring in the NBA.  With Lebron still climbing mountains at 34 years old in his 16th season, let us see how he ranks with the other members of the top 10 scoring list. 
              All the data queried is from basketball reference.  I put this into an excel document for some cleaning (for example adjusting Lebron’s 2018-2019 to simulate a full season) before reading the data into RStudio.  Using the dplyr package, I made some cumulative variables for assists, points, rebounds, and “triple-double points” (assists + points + rebounds):



How does Lebron Compare with the other top 10 scorers??
          Before we get too in-depth into the analysis, here is the top 10 in all time scoring per basketball reference on December 14th, 2018:




Using ggplot to plot the cumulative points of each player by season gives us:


 This graph is pretty difficult to look at with 10 different players.  Let us just focus on the top 5 for more a detailed analysis.  


         So taking a look at this graph we see Lebron hanging around the kareem(orange) and Malone(tan) area of the graph at this point in their career.   Lebron(blue) is well ahead of Kobe’s(green) pace and slightly behind Michael Jordan(purple).  The other thing to note is adjusting Lebron’s current 2018-2019 season numbers out has him already passing Michael Jordan.  
This graph is by season, let’s take a look at player’s age:



          The plot (below) truly shows how “ahead of the game” Lebron is.  Since he came straight from high school while other players went to college, with the exception of Kobe, he started his NBA career earlier than others.  In fact, Lebron already had nearly 4000 career points by age 21, the age at which Jordan entered the league.



Although by far the most important, points are not the only big stat in basketball.  A typical player’s performance is measured in assists and rebounds as well.  Taking a look at the top 5 scorer’s rebound numbers shows:

Lebron is middle of the pack, although Karl Malone and Kareem seem to be in the outer Kuiper Belt compared to the rest of the group.  These were “big men” so it makes sense they were the top rebounders.  

Lebron was only an average rebounder among the group.  However, rebounds and points are only two of the three most commonly considered basketball statistics.  There are assists as well.  Taking a look at the assists numbers shows:




Lebron is light years ahead of everyone in the top 5 of scoring in assists.  If one were to evaluate how impactful a player was, there ability to create points for others would not be too far behind the ability to score on their own.

To investigate further I combined points, assists, and rebounds to create a triple double statistic. Graphing the top 5 scorers in that category shows:


Lebron is hanging with Karl Malone this category.  Malone of course, was doing this by rebounds.  Lebron appeared to be matching with Jordan before breaking away around his 13th and 14th seasons.  Kareem is king with an exuberant number of rebounds that makes him the leader in this category.


Looking at his field goal percentage across the top 10 shows Lebron is about average in this group.  Expectedly, big men who were mainly taking closer shots have a higher field goal percentage among the group.



Forecasting Lebron’s Future.  Will he be the greatest of all time?

              Where Lebron stands at the current moment, it certainly seems he is one of the greatest basketball players of all time.  Of course, we need to forecast where he will be at the completion of his career.  One way to do this is to take a linear model of Lebron’s scoring and project it out to the future.  Using a simple OLS model regressing the cumulative sum of points on season to find the rate at which Lebron’s cumulative sum grows (aka how many points he averages a season) shows:


Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept)   156.24     192.74   0.811    0.431   
season       2075.01      19.93 104.100   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 367.5 on 14 degrees of freedom
Multiple R-squared:  0.9987,  Adjusted R-squared:  0.9986
F-statistic: 1.084e+04 on 1 and 14 DF,  p-value: < 2.2e-16

Naïvely we would assume that Lebron James scoring will grow at this rate, we can model with the dotted blue line below where he will end up:



          Amazingly, Lebron James will pass Kareem in all-time scoring according to this graph.  It looks like about midway through his 18th season, just two and a half years away.  As mentioned in the paragraph above the graph, this is a naïve estimate.  It is assuming Lebron James will not age at all and his numbers will continue to grow at the same rate.  Looking at the graph above, there is small dampening effect around a player’s 17th season.  In addition to decreased performance on the court, injuries plagued superstars like Kobe Bryant towards the end of his career.  Others like Michael Jordan were willingly winding down their NBA careers.

          I will call the age cutoff 36, and see how the scoring growth of a player past age 36 compares to their individual career.  I will do this by dividing the post 36 coeff by the pre 36 coeff and then take that percentage and multiply it by Lebron’s current rate to adjust for aging. This came out to 1765/1866=94.5%, a much higher percentage than I anticipated.  Because I am not a p-hacker I will go with it anyway.  His post age 36 rate will be .945 * 2075 = 1960

          So adjusting for his aging and projecting Lebron’s numbers out to 23 seasons (he may not play 23 but you can see the projection.)




             If Lebron continues on his path, he will pass Kareem at the end of year in his 18th season and still have a few more years to get some separation from the pack.  Depending on how long he can/wants to play in the NBA he can gain as much as 7000+ point separation from Kareem.  Assuming Lebron plays just 20 seasons, retiring at the ripe old age of 38, he would be ahead of Kareem by over 2000pts.  The numbers are incredible.

Add all this in of course with rebounds and assists which I a 22 season projection has Lebron netting 12,442 rebounds and 12,100 assists!  Such stats would have Lebron 1st all time in scoring, 2nd all time in assists, and 20th all time in rebounds.  If you were to add the triple double stats it would look like this:



Conclusion

              Lebron James is on amazing pace.  No one since Michael Jordan has had his stats grow at such a high rate.  When the King eventually retires, he will surely be the greatest basketball player of all time.  While many will stick the arguments of Jordan never lost in the finals, Wilt had a 100 pt game, etc Lebron’s truly astronomical career numbers will do the talking and claim his crown. 




How did Bobby Abreu Perform in Clutch Situations????

Was Bobby Abreu clutch? If you did not live in the sports vacuum of Philadelphia you would never understand why I would even bother writin...