## Help with calculating WARP (from basketball-prospectus)

Home for all your discussion of basketball statistical analysis.
jkeen39
Posts: 21
Joined: Mon Feb 03, 2014 10:04 pm

### Re: Help with calculating WARP (from basketball-prospectus)

Kevin Pelton wrote:Still not quite matching the others ...
jkeen39 wrote: Haslem: 106.75 [106.37]
Chalmers: 107.52 [107.06]
Battier: 107.39 [106.90]
On RebFactor3 ...

Reb and TmMinorPossessions are both at the league level.

The rest should be right.

LgFTScore is a bit of a mystery. It's .117 in my spreadsheet. Not sure if I accidentally pasted the value over the formula at some point. But using that will match things up.
Haha, well that is an interesting response. Do you use that same value for LgFTScore for all seasons? Just curious how you calculate WARP for other seasons/players since there seems to be some mystery involved although I can't imagine that specific factor has much of an overall impact (whether it's .117 or something else).

What type of non-scoring possessions is it supposed to represent?

jkeen39
Posts: 21
Joined: Mon Feb 03, 2014 10:04 pm

### Re: Help with calculating WARP (from basketball-prospectus)

Kevin Pelton wrote:
On RebFactor3 ...

Reb and TmMinorPossessions are both at the league level.

The rest should be right.

LgFTScore is a bit of a mystery. It's .117 in my spreadsheet. Not sure if I accidentally pasted the value over the formula at some point. But using that will match things up.
Ok, I think I have it. Posting for any others trying to calculate:

RebFactor3 = (83,513/208,413)/((1-.0484-.0729-.0596-.117)*(1-.4479)+.0484+(.117*.56*(1-.7525))) = .8861

jkeen39
Posts: 21
Joined: Mon Feb 03, 2014 10:04 pm

### Re: Help with calculating WARP (from basketball-prospectus)

Kevin Pelton wrote:Still not quite matching the others ...
jkeen39 wrote: Haslem: 106.75 [106.37]
Chalmers: 107.52 [107.06]
Battier: 107.39 [106.90]
Ok going to see if I can work my way back on one of these guys to see where I went wrong. Let me know which input is bad in this calculation for Chalmers:

TmDefRatMajor = (91.138+(((1-.7152)*.4686*.8861*1.121)*91.138))/.96 = 107.52

I think we're good on OppRebOpp% (.4686), RebFactor3 (.8861) and RebFactor2 (1.121).

So the only inputs that could be bad would be TmDefRatMinor (91.138) or TmDReb% (.7152), and then obviously something within those calculations is bad.

glwall3
Posts: 7
Joined: Fri Aug 15, 2014 6:57 pm

### Re: Help with calculating WARP (from basketball-prospectus)

I have figured the correct formulas to get defensive rating. The results correspond to what Kevin posted and also match the attachment at the beginning of this post. My offensive ratings match what jkeen39 has at the moment. Any help figuring out what we have done wrong would be appreciated. This has been a fun math puzzle. Looking forward to getting the offensive ratings figured out. The following is an example using Lebron James.

Defensive Possessions

Min = 2326
TmOppFGA = 5267
TmOppFTA = 1457
TmOppTO = 1043
TmMin = 16040

Pos = Min*((TmOppFGA + (.44 * TmOppFTA) + TmOppTO)/(TmMin/5))
Pos = 2326*((5267 + (.44 * 1457) + 1043)/(16040/5)) = 5039.966359

TmBSPos - An estimate of how many possessions end with a block or steal

Blk = 50
Stl = 115
Pos = 5039.966359
LgBlk = 10086
LgStl = 15200
LgPos = 208412.68

TmBSPos = (Blk + Stl)/Pos + .8*((LgBlk + LgStl)/LgPos)
TmBSPos = (50 + 115)/5039.966359 + .8*((10086 + 15200)/208412.68) = 0.129799587

LgFTARate - An estimate of how often a Personal Foul results in a free throw

LgFTA = 44472
LgPF = 38744

LgFTARate = (.44*LgFTA)/LgPF
LgFTARate = (.44*44472)/38744 = 0.505050588

TmFTAPos - An estimate of how many possessions end with a Free Throw Attempt

LgFTARate = .505050588
PF = 96
Pos = 5039.966359
LgFTA = 44472
LgPos = 208412.68

TmFTAPos = LgFTARate*(PF/Pos) + .8*((.44*LgFTA)/LgPos)
TmFTAPos = .505050588*(96/5039.966359) + .8*((.44*44472)/208412.68) = 0.084731359

TDF - Team Defense Factor - Percentage of team minutes played

Min = 2326
TmMin = 16040

TDF = Min/TmMin
TDF = 2326/16040 = 0.145012469

TmFTOPos - An estimate of how many possessions end with a forced Turnover

TDF = 0.145012469
TmOppTO = 1043
TmStl = 585
TmOppPos = 6951.08
LgTO = 27620
LgStl = 15200
LgPos = 208412.68

TmFTOPos = TDF*((TmOppTO-TmStl)/TmOppPos) + (1-TDF)*((LgTO-LgStl)/LgPos)
TmFTOPos = .145012469*((1043-585)/6951.08) + (1-.145012469)*((27620-15200)/208412.68) = 0.060506264

TmFGRat - An estimate of how many points each non-blocked Field Goal Attempt creates

TDF = 0.145012469
TmOppPts = 6105
TmOppFTM = 1056
TmOppFGA = 5267
TmBlk = 355
LgPts = 190594
LgFTM = 33465
LgOppFGA = 161225
LgBlk = 10086

TmFGRat = TDF*((TmOppPts - TmOppFTM)/(TmOppFGA - TmBlk)) + (1-TDF)*((LgPts - LgFTM)/(LgOppFGA - LgBlk))
TmFGRat = .145012469*((6105 - 1056)/(5267 - 355)) + (1-.145012469)*((190594 - 33465)/(161225 - 10086)) = 1.037929726

TmDefRatMinor - An estimate of how many points are allowed per defensive possession

TmFTAPos = 0.084731359
LgFTM = 33465
LgFTA = 44472
TmBSPos = 0.129799587
TmFTOPos = 0.060506264
TmFGRat = 1.037929726

TmDefRatMinor = 100* ((TmFTAPos * ((LgFTM)/(LgFTA*.44))) + (1 - TmFTAPos - TmBSPos - TmFTOPos) * TmFGRat)
TmDefRatMinor = 100* ((.084731359 * ((33465)/(44472*.44))) + (1 - .084731359 - .129799587 - .060506264) * 1.037929726) = 89.73695316

TmDReb% - An estimate of team's Defensive Rebound Percentage

DReb% = 19.69566971
LgDReb% = 73.04371774

TmDReb% = 100*((DReb%/100)+ ((4*(LgDReb%)/100))/(5-(LgDReb%)/100))*(1-(DReb%/100))))
TmDReb% = 100*((19.69566971/100)+((4*(73.04371774/100))/(5-(73.04371774/100))*(1-(19.69566971/100)))) = 74.64955683

OppFG% - An estimate of the opponent's Field Goal Percentage

TmFGRat = 1.037929726
Lg eFG% w/o Blocks = 0.519816196
Lf FG% = 0.447933013

OppFG% = (TmFGRat/2) / (Lg eFG% w/o Blocks/LgFG%)
OppFG% = (1.037929726/2) / (.519816196/.447933013) = 0.447199407

OppRebOpp%

OppFG% = .447199407
TmFTAPos = 0.084731359
TmBSPos = 0.129799587
TmFTOPos = 0.060506264
LgFTA = 44472
LgFTM = 33465
Blk = 50
Pos = 5039.966359
LgBlk = 10086
LgPos = 208412.68

OppRebOpp% = ((1 - OppFG%)*(1 - TmFTAPos - TmBSPos - TmFTOPos)) +(TmFTAPos*0.56*(1-(LgFTM/LgFTA))) +(Blk/Pos) +( 0.8*(LgBlk/LgPos))
OppRebOpp% = ((1 -.447199407)*(1 - .084731359 - .129799587 - .060506264)) +(.084731359*0.56*(1-(33465/44472))) +(50/5039.966359) +( 0.8*(10086/208412.68)) = 0.461140014

Rebound Factor 2

LgOffRatMajor = 102.5246384
LfOffRatMinor = 91.45028988
LgOReb = 22512
LgPos = 208412.68

RebFactor2 = (LgOffRatMajor - LgOffRatMinor) / (LgOffRatMinor * LgOReb/LgPoss)
RebFactor2 = (102.5246384 - 91.45028988) / (91.45028988 * 22512/208412.68) = 1.121096921

Rebound Factor 3

LgReb = 83513
LgPos = 208412.68
LgBlk% = 0.048394368
LgStl% = 0.072932223
LgTO% w/o Steals = 0.059593303
LgFTScore = .117
LgFG% = 0.447933013
LgFTM = 33465
LgFTA = 44472

RebFactor3 = (LgReb/LgPos)/((1-LgBlk%-LgStl%-LgTO% w/o Steals-LgFTScore)*(1-LgFG%)+LgBlk%+(LgFTScore*0.56*(1-(LgFTM/LgFTA))))
RebFactor3 = (83513/208412.68)/((1-.048394368-.072932223-.059593303-.117)*(1-.447933013)+.048394368+(.117*0.56*(1-(33465/44472)))) = 0.886122058

TmDefRat

TmDefRatMinor = 89.73695324
TmDReb% = 74.64955683
OppRebOpp% = 0.461140014
RebFactor2 = 1.121096921
RebFactor3 = 0.886122058

TmDefRat = (TmDefRatMinor+((1-(TmDReb%/100))*OppRebOpp%*RebFactor2*RebFactor3)*TmDefRatMinor)/0.96
TmDefRat = (89.73695324+((1-(74.64955683/100))*.461140014*1.121096921*.886122058)*89.73695324)/.96 = 104.3316261

glwall3
Posts: 7
Joined: Fri Aug 15, 2014 6:57 pm

### Re: Help with calculating WARP (from basketball-prospectus)

These are the values for each of the inputs for defensive rating for the other four players we were figuring.

Defensive Posessions

Mario Chalmers = 3954.401808
Dwyane Wade = 3521.042706
Udonis Haslem = 3443.038067
Shane Battier = 3248.026471

TmBSPos

Mario Chalmers = 0.12437261
Dwyane Wade = 0.138242256
Udonis Haslem = 0.114197302
Shane Battier = 0.126925561

TmFTAPos

Mario Chalmers = 0.096312568
Dwyane Wade = 0.090889441
Udonis Haslem = 0.095940907
Shane Battier = 0.091438217

TDF

Mario Chalmers = 0.113778055
Dwyane Wade = 0.101309227
Udonis Haslem = 0.099064838
Shane Battier = 0.093453865

TmFTOPos

Mario Chalmers = 0.06030962
Dwyane Wade = 0.060231119
Udonis Haslem = 0.060216989
Shane Battier = 0.060181664

TmFGRat

Mario Chalmers = 1.038296465
Dwyane Wade = 1.038442868
Udonis Haslem = 1.03846922
Shane Battier = 1.038535102

TmDefRatMinor

Mario Chalmers = 91.12560547
Dwyane Wade = 89.33968797
Udonis Haslem = 92.17935414
Shane Battier = 90.56351737

TmDRB%

Mario Chalmers = 71.51815466
Dwyane Wade = 72.09923354
Udonis Haslem = 76.50428811
Shane Battier = 70.85608897

OppFG%

Mario Chalmers = 0.447357419
Dwyane Wade = 0.447420498
Udonis Haslem = 0.447431852
Shane Battier = 0.447460238

OppRebOpp%

Mario Chalmers = 0.452199235
Dwyane Wade = 0.461888945
Udonis Haslem = 0.462162187
Shane Battier = 0.460181384

TmDefRatMajor

Mario Chalmers = 107.0676827
Dwyane Wade = 104.9763399
Udonis Haslem = 106.3783095
Shane Battier = 106.9058499

glwall3
Posts: 7
Joined: Fri Aug 15, 2014 6:57 pm

### Re: Help with calculating WARP (from basketball-prospectus)

These are the inputs I have for Mario Chalmer's Offensive Rating. Any help in determining where I went wrong would be appreciated!
AstFGM% - An estimate of what percentage of Field Goals Made were Assisted
=(TmAst/TmFGM)*(1.53-1.442*((Ast/MP)/(TmAst/(TmMP/5)))-(.041*((ORB/MP)*48))-(.787*Usage1)+(.014*(3PA/FGA)^2*((1/Usage1)^2)))
=(1317/2446)*(1.53-1.442*((222/1825)/(1317/(16040/5)))-(.041*((16/1825)*48))-(.787*.174715843)+(.014*(260/498)^2*((1/.174715843)^2)))=0.577727594

AstFGM - An estimate of how many Field Goals Made were Assisted
=AstFGM%*FGM
=.577727594*223=128.8332535

Points Created (PC) - An estimate of offensive points created
=Points+(.75*Ast)-(.75*AstFGM)
=627+(.75*222)-(.75*128.8332535)=696.8750599

Offensive Possessions (OPos) - An estimate of the number of individual possessions
=FGA+(.44*FTA)+TO+(.375*Ast)-(.375*AstFGM)
=498+(.44*101)+142+(.375*222)-(.375*128.8332535)=719.3775299

Offensive Rating (OffRat) - Player's individual rating
=(PC/OPos)*100
=(696.8750599/719.3775299)*100=96.87195262

Usage2
=(OPos/Min)/((TmFGA+(.44*FTA)+TmTO)/(TmMin/5))
=(719.3775299/1825)/((5212+(.44*1598)+971)/(16040/5))=0.183634287

TmOffRatMinor - An estimate of the Offensive Rating for the player and four league average players
=(OffRat*Usage1)+((1-Usage1)*(LgOffRat+(.25*(Usage1-.2)*100)))
=(96.87195262*0.174715843)+((1-0.174715843)*(91.45028988+(.25*(0.174715843-.2)*100)))=91.87587488

TmOReb% - An estimate of the imaginary team's Offensive Rebound %
=100*((OReb%/100)+ ((4*(LgOReb%)/100))/(5-(LgOReb%)/100))*(1-(OReb%/100))))
=100*((1.088847523/100)+((4*(26.95628226/100))/(5-(26.95628226/100))*(1-(1.088847523/100))))=23.63456028

PlayerRebOpp% - An estimate of the number of available rebounds for the player
=((FGA-FGM)+(0.56*(FTA-FTM)))/(FGA+(0.44*FTA)+TO)
=((498-223)+(.56*(101-80)))/(498+(.44*101)+142)=0.418970253

TeammateOffRat - An estimate of the Offensive Rating for the four league average players
=LgOffRat+(0.25*(Usage2-0.2)*100)
=91.45028988+(.25*(.183634287-.2)*100)=91.04114706

Teammate FGA% - An estimate of the percentage of Field Goal Attempts for the four league average players
=(1-((LgTO/LgPos)*(1+(0.5*(0.2-Usage1))))-(LgFTA/LgPoss)*0.44)
=(1-((27620/208412.68)*(1+(.5*(.2-.174715843))))-(44472/208412.68)*.44)=0.771909971

Teammate eFG% - An estimate of the eFG% for the four league average players
=((TeammateOffRat/100)-(LgFTM/LgPos))/(Teammate FGA%*2)
=((91.04114706/100)-(33465/208412.68))/(.771909971*2)=0.485704716

Teammate FG% - An estimate of the FG% for the four league average players
=Teammate eFG%/(Lg eFG%/Lg FG%)
=.485704716/(0.487297255/0.447933013)=0.446469121

TeammateRebOpp% - An estimate of the number of available rebounds for the four leauge average players
=(1-Teammate FG%)*Teammate FGA% +(0.56*((LgFTA-LgFTM)/LgPos))
=(1-.446469121)*.771909971+(.56*((44472-33465)/208412.68))=0.456851556

TmRebOpp% - An estimate of the imaginary team's ability to rebound
=(PlayerRebOpp%*Usage1)+(TeammateRebOpp%*(1-Usage1))
=(.418970253*.174715843)+(.456851556*(1-.174715843))=0.450233092

RebFactor1 - Adjustment to take account for the fact that every missed shot does not result in a rebound
=LgReb/((LgFGA-LgFGM)+0.56*(LgFTA-LgFTM))
=83513/((161225-72218)+.56*(44472-33465))=0.87750544

RebFactor2 - Adjustment to take account for possessions that include more than one second chance
=(LgOffRatMajor-LgOffRatMinor)/(LgOffRatMinor*(LgOReb/LgPos))
=(102.5246384-91.45028988)/(91.45028988*(22512/208412.68))=1.121096918

TmOffRat - An estimate of the Offensive Rating for the imaginary team
=TmOffRatMinor+(TmOReb%*TmRebOpp%*RebFactor1*RebFactor2)
=91.87587488+(23.63456028*.450233092*.87750544*1.121096918)=102.3442172

TmOffRat3 - An estimate of the offensive rating for the imaginary team with an adjustment for floor spacing
=(TmOffRat+(7*(3A%-Tm3A%)))/0.96
=(102.3442172+(7*(0.379872597-0.149576249)))/.96=108.2878038

Kevin Pelton
Posts: 102
Joined: Thu Apr 14, 2011 10:05 pm

### Re: Help with calculating WARP (from basketball-prospectus)

Found two discrepancies.

First, there are a couple of places in the teammate section where the formula calls for Usage1 and you're using Usage2. That one's pretty minor. The bigger difference is because in the TmOffRat that whole section needs to be multiplied by TmOffRatMinor.

glwall3
Posts: 7
Joined: Fri Aug 15, 2014 6:57 pm

### Re: Help with calculating WARP (from basketball-prospectus)

That worked! Thanks! I will now attempt to calculate WARP for every team for this season.

Posts: 201
Joined: Thu Dec 04, 2014 12:58 pm

### Re: Help with calculating WARP (from basketball-prospectus)

I've hand calculated Kubatko's Win Shares countless times. I notice many similarities, the obvious, ORtg, DRtg, Accounting for Usage, % of Tm MP, Accounting for Lg FT's, Defensive Stops, Attempting to account for individual defensive impact on Opponent FG Att, without me looking too much into the nuts and bolts at this very moment, what are the major differences between WS and WARP ?
The Bearded Geek

Kevin Pelton
Posts: 102
Joined: Thu Apr 14, 2011 10:05 pm

### Re: Help with calculating WARP (from basketball-prospectus)

Yeah, WARP and Win Shares both have a common Dean Oliver lineage. Three main differences I see:

1. WARP is the only non-SPM system that attempts to account for floor spacing with the adjustment for 3-point attempts. In fact, this is something of an SPM element since it came from comparing WARP results to adjusted plus-minus.

2. Win Shares credits all team defense to individuals (and, generally, is constrained by team performance). So players on good defenses look better by Win Shares and those on poor defenses look better by WARP -- particularly big men.

3. Lastly, while I couldn't articulate exactly how Win Shares handles usage, it's my experience that there isn't nearly as big an adjustment for it as in WARP. WARP falls somewhere between PER and Win Shares on this continuum (and also in terms of team defense).

Posts: 201
Joined: Thu Dec 04, 2014 12:58 pm

### Re: Help with calculating WARP (from basketball-prospectus)

When accounting for replacement level, how is this calculated? It says, generally around .415, I believe? How greatly does this vary year-to-year?, would .500 make for 'Wins Above Average' ?
The Bearded Geek

Kevin Pelton
Posts: 102
Joined: Thu Apr 14, 2011 10:05 pm

### Re: Help with calculating WARP (from basketball-prospectus)

It's set at whatever creates 930 total WARP around the league, matching up with a replacement level of 10 wins per team per season. Matches up pretty well with what I've found when I look at actual replacement-level players, though Daniel Myers' studies have shown slightly higher replacement level.

Yeah, there's an ancient wins above average column in my spreadsheet but I've never used it.

Posts: 201
Joined: Thu Dec 04, 2014 12:58 pm

### Re: Help with calculating WARP (from basketball-prospectus)

I clicked on the Basketball Prospectus link and saw it was updated in 2012. I didn't recall that thorough of an explanation of how exactly marginal wins were arrived it. Knew it was the Pythagorean theorem, the constant ^14 exponent, and that it was Individual WPct minus .415, I just didn't recall the detailed explanation that followed, I had an older version saved. I'm just curious now that you've better explained it, how much of a difference would come from your calculations and J. Kubatko's, if you simply plugged in his O & DRtg's, and compared them to WARP, by your explanation, this would give me a sense of how many wins came solely from a player's ability to space the floor, and say a big's rim protection or a wing's ability to disrupt an opponent's shot ? Given that, like you said, Win Shares allocates all team defense to individual players. I didn't remember seeing the floor spacing component either.
The Bearded Geek

JoshEngleman
Posts: 127
Joined: Thu Oct 23, 2014 12:13 pm
Location: Wilmington, NC
Contact:

### Re: Help with calculating WARP (from basketball-prospectus)

OK, this is driving me insane and I can't take it anymore. I've been trying to replicate this today and I have hit a snag. I'm hoping someone can quickly help me.

I can't figure out where LgOffRatMajor comes from. I've read this whole thread and KP's original article and I just can't figure it out.

I'm stuck on RebFactor2. Any help would be greatly appreciated.

Kevin Pelton