21
OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer 1 Shane Jensen 2 Gregory Matthews 3 1 Smith College 2 The Wharton School University of Pennsylvania 3 University of Massachusetts Joint Mathematical Meetings Baltimore, MD January 17th, 2014 Baumer (Smith) openWAR JMM 1 / 21

OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

OpenWAR:An Open Source System for Overall Player Performance in MLB

Ben Baumer1 Shane Jensen2 Gregory Matthews3

1 Smith College

2 The Wharton SchoolUniversity of Pennsylvania

3 University of Massachusetts

Joint Mathematical MeetingsBaltimore, MD

January 17th, 2014

Baumer (Smith) openWAR JMM 1 / 21

Page 2: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Introduction Motivation

WAR - What is it good for?

Wins Above Replacement

Question: How large is the contribution that each player makestowards winning?

Four Components:1 Batting2 Baserunning3 Fielding4 Pitching

Replacement Player: Hypothetical 4A journeymanI Much worse than an average player

Baumer (Smith) openWAR JMM 2 / 21

Page 3: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Introduction Motivation

Units and Scaling

In terms of absolute runs:

10 40 90 140

Miguel CabreraAverageReplacementMe

In terms of Runs Above Replacement (RAR):

−30 0 50 100

Miguel CabreraAverageReplacementMe

In terms of Wins Above Replacement (WAR):

−3 0 5 10

Miguel CabreraAverageReplacementMe

Baumer (Smith) openWAR JMM 3 / 21

Page 4: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Introduction Motivation

Example: 2012 WAR leaders

FanGraphs fWAR BB-Ref rWAR

Mike Trout 10.0 Mike Trout 10.9Robinson Cano 7.8 Robinson Cano 8.5Buster Posey 7.7 Buster Posey 7.4Ryan Braun 7.6 Miguel Cabrera 7.3

David Wright 7.4 Andrew McCutchen 7.2Chase Headley 7.2 Adrian Beltre 7.0Miguel Cabrera 6.8 Ryan Braun 7.0

Andrew McCutchen 6.8 Yadier Molina 6.9

Table : 2012 WAR Leaders

Baseball Prospectus also publishes WARP

There is no ONE formula for WAR!

Baumer (Smith) openWAR JMM 4 / 21

Page 5: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Introduction Motivation

WAR is the Answer

Baumer (Smith) openWAR JMM 5 / 21

Page 6: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Introduction Related Work

What’s Wrong with WAR?

Not ReproducibleI WAR is an unknown hypothetical quantity – not a statisticI No reference implementation of WARI No open data setI No open source code

No unified methodologyI Each component of WAR is viewed as a separate problem – not a piece

of the same problemI Ad hoc definitions: what is replacement level?

No error estimatesI Only reported as point estimatesI Only hand-wavy estimates of variability or margin or error

Bug or Feature?: Competing black-box implementations

Baumer (Smith) openWAR JMM 6 / 21

Page 7: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Introduction Our Contribution

Our Contribution: openWAR

openWAR : a reproducible reference implementation of WARI Principled estimate of WARI Fully open-source R package (free as in freedom)I Partially open data (free as in beer)

Unified Methodology:I Conservation of RunsI Each component is estimated as a piece of the larger problem

Error estimates:I Use resampling methods to report WAR interval estimates

Version 0.1: Emphasis at this stage on reproducibility

Baumer (Smith) openWAR JMM 7 / 21

Page 8: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

openWAR R package

openWAR

R package to be submitted to CRAN

Currently available for download on GitHub

https://github.com/beanumber/openWAR

Scrapes XML files from MLBAM GameDay server

Processes using XSLT and compiles detailed play-by-play info into adata frame

Computes openWAR

Diagnostic and visualization tools

Paper (currently under review)

http://arxiv.org/abs/1312.7158

Baumer (Smith) openWAR JMM 8 / 21

Page 9: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Modeling

Conservation of Runs

ρ(baseCode, outs): expected number of runs scored in remainder ofinning, from the state (baseCode, outs)

Empirically estimate ρ̂

Conservation of Runs:I Every run gained by the offense is a run lost by the defense

δi : Change in expected runs occuring on the i th play:

δi = ρ(bi+1, oi+1) − ρ(bi , oi ) + runsOnPlayi

Baumer (Smith) openWAR JMM 9 / 21

Page 10: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Modeling Modeling

Sample Play

5/08/2013: 2 outs, Nick Markakis on 2B, Adam Jones on 1B

Matt Wieters doubles to right center and both runs score

δ̂i = ρ̂(2, 2) − ρ̂(3, 2) + 2 = 0.31 − 0.41 + 2 = 1.90

https://cvmdo.bamnetworks.com/mlbam/2013/05/08/347228/

coaching_video/cv_26934817_4500K.mp4

How to allocate responsibility among the offensive and defensiveplayers?

Baumer (Smith) openWAR JMM 10 / 21

Page 11: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Modeling Modeling

openWAR accounting

δ = 1.90 runs

δbr = 0.32 runs, after controlling for ballpark and platoon advantageI The runner on first (Jones) gets 91% of the baserunning creditI The runner on second (Markakis) gets 9% of the baserunning credit

δbat = 1.58 runs goes to the batter (Wieters)I Remains 1.58 runs after controlling for the fact that Wieters is a

catcher

δfield = −0.70 runs (37% of the blame) go to the fieldersI 68% of that blame (−0.47 runs) goes to the CFI 32% of that blame (−0.22 runs) goes to the RFI Negligible amounts go to the other fielders

δpitch = −1.20 runs (63% of the blame) goes to the pitcher

Baumer (Smith) openWAR JMM 11 / 21

Page 12: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Modeling Modeling

Cumulative Fielding Model

Horizontal Distance from Home Plate (ft.)

Ver

tical

Dis

tanc

e fr

om H

ome

Pla

te (

ft.)

−100

0

100

200

300

400

−300 −200 −100 0 100 200

0.10.2

0.2

0.2

0.2

0.2

0.3

0.3

0.4

0.4

0.5

0.5 0.5

0.5

0.6

0.6 0.6

0.6

0.6

0.6

0.6

0.7

0.7

0.7

0.7

0.8

0.8

0.8

0.8

0.9

0.0

0.2

0.4

0.6

0.8

1.0

Baumer (Smith) openWAR JMM 12 / 21

Page 13: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Modeling Modeling

Defining Replacement Level

Scarcity: Only 30 · 25 = 750 roster spotsI Take the 750 players who played the mostI All other players are by definition “replacements”

Replacement players have an average RAA per plate appearance

Each player is assigned a replacement-level shadow based on theirplaying time (shown in gray in next slide)

Baumer (Smith) openWAR JMM 13 / 21

Page 14: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Modeling Modeling

Defining Replacement Level - openWAR 2012

Number of Players = 1284 , Number of Replacement Level Players = 534Playing Time (plate appearances plus batters faced)

open

WA

R R

uns

Abo

ve A

vera

ge

−40

−20

0

20

40

0 200 400 600 800 1000

Trout

Kershaw

Blackburn

Total RAA = 0Total WAR = 1166.3

MLB Player Replacement Player● ●

Baumer (Smith) openWAR JMM 14 / 21

Page 15: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Modeling Modeling

Defining Replacement Level - rWAR 2012

Playing Time, 2012 (plate appearances plus batters faced)

rWA

R R

uns

Abo

ve A

vera

ge

0

50

0 200 400 600 800 1000

Mike Trout

Justin Verlander

Jeff Francoeur

Total RAA = 298.5Total WAR = 1008.7

Baumer (Smith) openWAR JMM 15 / 21

Page 16: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Modeling Modeling

Defining Replacement Level - openWAR 2012 normalized

Number of Players = 1284 , Number of Replacement Level Players = 603Playing Time (plate appearances plus batters faced)

open

WA

R R

uns

Abo

ve A

vera

ge

−40

−20

0

20

40

0 200 400 600 800 1000

Trout

Kershaw

Blackburn

Total RAA = 0Total WAR = 1005.2

MLB Player Replacement Player● ●

Baumer (Smith) openWAR JMM 16 / 21

Page 17: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Results

Modeling Uncertainty

Both rWAR and fWAR are published as point estimates, not intervalestimates

openWAR models player sampling error

Recall: each player at each position is assigned an RAA value for eachplay

Idea: resample these values many times!

Quantitative assessment of uncertainty enables nuanced conclusions

Baumer (Smith) openWAR JMM 17 / 21

Page 18: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Results

Cabrera vs. Trout, 2012

Simulated 2012 openWAR: Mike Trout

Sim

ulat

ed 2

012

open

WA

R: M

igue

l Cab

rera

2

4

6

8

10

12

4 6 8 10 12

●●●

●●

● ●

● ●

●●

●●

● ●

● ●

● ●

●● ● ●

●●

●●●●

●●●

●●

●●

●●

● ●

● ●

●●

●●

●●

●●

●● ●

●●

●● ●

● ●

● ●

●●

● ●

● ●●

●●

●●

●●

●●

● ●

●●

●●

●●

●●

● ●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●● ●

●●

●●

● ●●

●●

●●

●●

●●

●●

● ●

●●

●●

● ●

●●

●●

●●

● ●

● ●

●●

● ●

● ●

●●

●●

●●

●●

● ●●

●●

●●● ●

●●

●●●●

●●●

● ●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

● ●

●●●

●●

●●

●●

● ●●

●●

●●

●●

●●

● ●

●●

●●

●●

●●

●●

●●●

●●●

●●

● ●●

● ●

●●

●●

●●

●●●

●●

●● ●

● ●●

● ●

●●

●●●

●●

●●

●●

●● ●

●●

●●

●●

●●

●●

● ●

●●

●●

●●

●●

●●

●●

●●

●●

●●

● ●

● ●

● ●

●●

● ●

●●

●●

● ●

●●

●●

●●

● ●

● ●

● ●●

●●

●●

●●

● ●●

●●

●●●

● ●

●●

●●

●●

●●

● ●●

●●

● ●

● ●● ●●

●● ●

●●

●●●

● ●

●●●

●●

●●

●●

● ●

●●

● ●

●●

●●

●●

●●

● ●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

● ●

●●

● ●

● ●●

●●●

● ●

●●●

●●

●●

●●

●●

● ●●

●●

● ●

● ●●

●●●

●●●

●●●

●●●

● ●

●●

●●

●●

●●

●●

●●

●●

●●

● ●

●●

●●

●●

●●

●●

● ●●

●●●

●●

●●

●●

●●

●●

●●

● ●

● ●

●●

●●

●●

●●

●●

●●

●●

● ●

●● ●

●●

● ●

●●●

●● ●

●●

●●● ●

● ● ●

● ●

●●

●●

● ●●

●●

● ●●

●●

●●

●●

● ●

●●

●●

●●

● ●

●●

●●

●●

●● ●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

● ●

●●

●●●

●●

●●

● ●● ●

●●

●●

●●

●●

●●● ●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

● ●

●●

●●

●●

●●

● ●

●●

●●●

●● ●

●●

● ●

●●●●

●●

●●

● ●●●

●●

●●

●●

● ●

●●

●●

●●

● ●●●

●●

● ●●

● ●

●●

●●

●●

●●

● ●

●●

● ●

● ●●

●● ●

● ● ●

●●

● ●

● ●

●●

●●

●●

●●

●●●

●●

●●

● ●

●● ●

●●

●●●

● ●

●●

●●

●●

●●●

●●

●● ●

●●

●●

●●

●●

●●

● ●

● ●

●●

● ●●

● ●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

● ●

●●

● ●

●●●●

●●

●●

●●

●●

●●

●●

●● ●

●●

● ●

●●

● ●

● ●

●●

● ●

●●

●●

●●

●●●

●●

●●

● ●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

● ●

●●●

●●

●●

● ●

●●

●●

●●

●●

● ●●

●●

●●

●●

●●

●●

● ●

●●

●● ●

● ●

●●

●●

●●

●●

●●

●●

● ●●

● ●●

●●

●● ●

●●

●●

●●

● ●

● ●

●●

●●

●●●

● ●●

●●

●● ●

●●

●●

●●● ●

● ●

●●

●●

●●

●●●●

● ●●

●●

●●

●●

●● ●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●● ●

●●

●●

●●

●●●●

●●

●●

●●

●●

● ●

●●

●●

●●

● ●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

● ●

●●

●●

●●

●● ●

●●●●

●●●●

●●

●●

●●

●●

●●

●●

●●

● ●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

● ●

●●

●●

●●

●●●

●●

●●●

● ●

●●

● ●

●●

●●

●●

●●

●●

●●●

●● ●

●●

●●

●●

● ●

●●

●●

● ●

●●

●●

●●

●●

●●

●●

●●

● ●

● ●●

●●

● ●

●●

● ●

●●

●●

● ●

●●

●●

●●●

●● ●

●●

● ●

●●

●●

●● ●

● ●

●●

●●

●●

●●

●●

● ●●●

●●

●●

●●

Cabrera better 31.6 %

Trout better 68.4 %

Baumer (Smith) openWAR JMM 18 / 21

Page 19: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Results

Uncertainty (Sampling)

Name q0 q2.5 q25 q50 q75 q97.5 q100

Trout 3.96 5.90 7.66 8.58 9.50 11.26 13.34Cano 2.43 4.77 6.82 7.94 9.06 11.17 13.85

Cabrera, Mi 2.17 4.40 6.40 7.51 8.55 10.72 13.24Headley 2.53 4.56 6.39 7.46 8.47 10.42 13.00

Encarnacion 2.45 4.47 6.33 7.32 8.27 10.09 13.08McCutchen, A 2.33 4.41 6.25 7.27 8.26 10.27 12.21

Votto 2.68 4.80 6.23 7.01 7.81 9.28 11.40Fielder 2.11 4.12 5.99 6.98 7.95 9.82 12.22Posey 2.09 4.14 5.80 6.75 7.67 9.61 11.68Mauer 2.63 4.30 5.88 6.74 7.60 9.27 10.91

Table : Interval estimates for 2012 openWAR Leaders: 3500 simulations

Baumer (Smith) openWAR JMM 19 / 21

Page 20: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Conclusion

Limitations

Data integrity

Stolen bases and wild pitches not properly accounted

Cannot distribute data with the R package

Can’t distinguish between batted ball trajectories or speeds

Defense measures only range – not sure-handedness, throwing, etc.

Baumer (Smith) openWAR JMM 20 / 21

Page 21: OpenWAR: - An Open Source System for Overall Player ...bbaumer/w/pub/openWARtalk.pdf · OpenWAR: An Open Source System for Overall Player Performance in MLB Ben Baumer1 Shane Jensen2

Conclusion

Summary

THANK YOU!!

Baumer (Smith) openWAR JMM 21 / 21