It’s currently the offseason for MLB, which means a lot of players changing teams, either through free agency or trade. It sometimes feels like players spend less time with their teams then they used to, and thankfully the data to check this is readily available.
We’ll be measuring player “stints” - that is, consecutive years with one team. As an example, we’ll look at Curtis Granderson:
Grandy had 7 stints in total - 6 years with the Tigers, 4 with the Yankees, 4 with the Mets, and 1 year each with the Dodgers, Blue Jays, Brewers, and Marlins. He split time between teams in two seasons, so for both league and team summaries we’ll weigh the average stint duration by plate appearances for hitters and innings pitched for pitchers.
Show the code
league_plot <- player_stint_data %>%group_by(yearID, type) %>%summarise(mean_stint_seaons_left =mean(stint_seaons_left),mean_stint_seasons_played =mean(stint_seasons_played),w_mean_stint_seaons_left =weighted.mean(stint_seaons_left, wgt),w_mean_stint_seaons_played =weighted.mean(stint_seasons_played, wgt) ) %>%ggplot(aes(x = yearID, y = w_mean_stint_seaons_played, color = type, text =paste("<br>Year:", yearID,"<br>Player Type:", type,"<br>Weighted Stint Duration:", round(w_mean_stint_seaons_played,3))))+geom_line(group =1)+theme_ipsum()+ylab('Weighted Average Stint Duration')+xlab('Season')+scale_color_manual(values =c('#002D72', '#D50032'))ggplotly(league_plot, tooltip ='text')
Some interesting stories emerge here. Firstly, it’s assuring to see the low numbers in the 1880s - if those had been higher my formulas would be broken, so this passes the sniff test. Secondly, we see the effect of WWII in the 1940s, when many players went overseas to fight. We see a peak in the 60s, peaking in 1968 when Mickey Mantle’s 18-year run with the Yankees came to an end, along with Roy Face’s 14 years with the Pirates and Vada Pinson’s 11 with the Reds.
Since the 90s, batters have tended to stay with a team about 3.3 years or so, while pitchers are around 2.8. However; the gap has grown some as teams have turned more to the bullpen, where pitchers tend to have shorter tenures.
The story is even more interesting if we break it down by team. We’ll just look at the 30 active teams just to keep things clean.
The 70s Tigers had some guys stick around - Al Kaline ended a 22 year career, while Norm Cash, Mickey Stanley and Willie Horton each finished 15 years. We see several Yankee dynasties, while Cincinnati’s Big Red Machine jumps out in the 70s.
For kicks and giggles, I took a look at a team’s winning percentage against average stint duration.
Show the code
against_win_perc <- player_stint_data %>%group_by(yearID, franchID) %>%summarise(mean_stint_seaons_left =mean(stint_seaons_left),mean_stint_seasons_played =mean(stint_seasons_played),w_mean_stint_seaons_left =weighted.mean(stint_seaons_left, wgt),w_mean_stint_seaons_played =weighted.mean(stint_seasons_played, wgt)) %>%filter(yearID >=1920) %>%inner_join(teams %>%mutate(win_perc = W / (W + L)) %>%select(yearID, franchID, win_perc, LgWin, WSWin))team_corr <- against_win_perc %>%ggplot(aes(x = win_perc, y = w_mean_stint_seaons_played))+geom_point(alpha =0.3, color ='#40bf40',aes(text =paste("Team:", franchID,"<br>Year:", yearID,"<br>Win Percentage:", round(win_perc, 3),"<br>Weighted Stint Duration:", round(w_mean_stint_seaons_played,3))))+geom_smooth(method ='lm', se =FALSE, color ='grey', linetype ='dashed')+theme_ipsum()+ylab('Weighted Average Stint Duration')+xlab('Win Percentage')ggplotly(team_corr, tooltip ='text', height =650, width =650)
This looks interesting - and the r-squared is .18, so it’s certainly not nothing. But the conclusion should not be that “teams that have played together longer perform better”, rather, it’s “good players tend to stick around, and teams that have good players win more games”.
Finally, just for fun, here are the longest stints for each currently active team.