Setting Up Excel File for RAPM

Home for all your discussion of basketball statistical analysis.
nbacouchside
Posts: 151
Joined: Sun Jul 14, 2013 4:58 am
Contact:

Re: Setting Up Excel File for RAPM

Post by nbacouchside »

permaximum wrote:Well, this standardize=FALSE thing made me go back to this stuff and today I had free time to start over again. I calculated 2009 RAPM from the same source and I can confirm there hasn't been a single mistake or error in the process. But I can't confirm if there are any errors in the source data from basketballvalue.com.

Code: Select all

R: 3.3.1
glmnet: 2.0.5
CV-method: 10-times repeated 10-fold cross-validation
Lambda: 0.68
Logged RAPM value variance between lambdas 0.6 to 0.7 = +- 0.3
Used R-Code:

Code: Select all

library(doParallel)
library(glmnet)
rapm <- read.table("c:/users/hidden/downloads/rapm2009.csv", sep=";", header=TRUE)
x <- as.matrix(rapm[c(-1,-2)])
y <- as.matrix(rapm[c("Rtg")])
lambdas = NULL
require(doParallel)
registerDoParallel(7)
for (i in 1:10)
{
    fit <- cv.glmnet(x,y,alpha=0,weights=rapm$Poss,nfolds=10,parallel=TRUE,standardize=FALSE,lambda=seq(0.6, 0.7, by=0.001))
    errors = data.frame(fit$lambda,fit$cvm)
    lambdas <- rbind(lambdas,errors)
}
lambdas <- aggregate(lambdas[, 2], list(lambdas$fit.lambda), mean)
bestindex = which(lambdas[2]==min(lambdas[2]))
bestlambda = lambdas[bestindex,1]
fit <- glmnet(x,y,alpha=0,weights=rapm$Poss,standardize=FALSE,lambda=bestlambda)
coef(fit)
RAPM results

Code: Select all

          PLAYER           ORAPM   DRAPM   RAPM   
 ------------------------ ------- ------- ------- 
  Odom, Lamar               3.88    3.11    6.99  
  James, LeBron             4.13    2.75    6.88  
  Paul, Chris               3.58    1.98    5.56  
  Ming, Yao                 1.95    2.94    4.90  
  Wade, Dwayne              3.87    0.98    4.85  
  Hinrich, Kirk             2.17    2.51    4.68  
  Lewis, Rashard            2.70    1.92    4.63  
  Garnett, Kevin            0.88    3.64    4.52  
  Bonner, Matt              2.15    2.23    4.38  
  Allen, Ray                2.55    1.82    4.38  
  Kidd, Jason               2.05    2.23    4.28  
  Smith, J.R.               2.50    1.42    3.92  
  Wallace, Ben              1.44    2.37    3.81  
  Nash, Steve               4.36   -0.62    3.73  
  Nelson, Jameer            2.25    1.47    3.73  
  Murray, Ronald (Flip)     1.91    1.74    3.65  
  Bryant, Kobe              3.29    0.31    3.61  
  West, Delonte             1.13    2.40    3.53  
  Granger, Danny            3.74   -0.31    3.43  
  Kirilenko, Andrei         1.24    2.14    3.38  
  Howard, Dwight            1.61    1.64    3.25  
  Turkoglu, Hedo            1.03    2.20    3.23  
  Hill, Grant               2.29    0.86    3.14  
  Aldridge, LaMarcus        2.87    0.26    3.14  
  Parker, Tony              2.79    0.33    3.12  
  Millsap, Paul             1.23    1.88    3.11  
  Hilario, Nene             1.97    1.11    3.08  
  Roy, Brandon              3.06   -0.03    3.03  
  Anthony, Carmelo          2.87    0.11    2.98  
  Iguodala, Andre           1.38    1.57    2.96  
  Artest, Ron               0.56    2.39    2.95  
  Jaric, Marko              0.01    2.92    2.94  
  Wallace, Rasheed          1.74    1.17    2.91  
  Blake, Steve              2.68    0.15    2.84  
  Smith, Josh               1.76    1.08    2.84  
  Rondo, Rajon              1.83    0.99    2.82  
  Noah, Joakim              1.74    1.03    2.77  
  Young, Thaddeus           0.55    2.04    2.59  
  Foster, Jeff              0.53    2.03    2.57  
  Howard, Josh              1.64    0.92    2.56  
  Moon, Jamario             0.86    1.69    2.55  
  Stojakovic, Peja          2.98   -0.44    2.53  
  Gasol, Pau                2.68   -0.16    2.52  
  Przybilla, Joel          -0.82    3.33    2.51  
  Bogut, Andrew            -1.05    3.55    2.50  
  Powe, Leon                0.83    1.63    2.46  
  Udoka, Ime                0.19    2.27    2.46  
  Johnson, Amir            -0.17    2.62    2.45  
  Bosh, Chris               2.59   -0.21    2.39  
  Nocioni, Andres           3.14   -0.77    2.37  
  Ilgauskas, Zydrunas       1.04    1.26    2.30  
  Pierce, Paul              1.09    1.17    2.27  
  Redd, Michael             3.24   -1.01    2.23  
  Johnson, Joe              2.35   -0.13    2.22  
  Fernandez, Rudy           1.27    0.82    2.09  
  Thomas, Tim               0.14    1.90    2.04  
  Wallace, Gerald           0.05    1.99    2.04  
  Telfair, Sebastian        2.42   -0.37    2.04  
  Fisher, Derek             1.56    0.48    2.03  
  Battier, Shane            0.57    1.44    2.01  
  Haddadi, Hamed            0.52    1.47    1.99  
  Harrington, Al            1.38    0.58    1.96  
  Parker, Anthony           0.66    1.29    1.95  
  Batum, Nicolas            2.19   -0.24    1.95  
  Wafer, Von                1.78    0.13    1.91  
  Chandler, Tyson           1.13    0.72    1.85  
  Martin, Kenyon            0.05    1.80    1.85  
  Hayes, Jarvis            -0.12    1.98    1.85  
  Varejao, Anderson         1.03    0.80    1.83  
  Jefferson, Al             1.22    0.58    1.79  
  West, David               1.56    0.20    1.76  
  Nowitzki, Dirk            2.04   -0.33    1.71  
  Gallinari, Danilo         1.22    0.45    1.67  
  Cardinal, Brian           1.59    0.08    1.67  
  Williams, Mo              1.23    0.41    1.64  
  Marshall, Donyell         1.76   -0.15    1.61  
  Turiaf, Ronny             2.31   -0.72    1.59  
  Okur, Mehmet              1.98   -0.41    1.57  
  Mason, Desmond            0.09    1.47    1.56  
  Gordon, Ben               2.02   -0.49    1.53  
  Oden, Greg                2.16   -0.65    1.51  
  Mason, Roger              1.09    0.40    1.49  
  Weaver, Kyle              0.67    0.80    1.47  
  Hollins, Ryan             0.12    1.36    1.47  
  Camby, Marcus            -1.45    2.89    1.44  
  Simmons, Bobby            1.53   -0.10    1.42  
  Magloire, Jamaal          0.86    0.55    1.42  
  Robinson, Nate            1.60   -0.19    1.41  
  Collins, Mardy            0.18    1.21    1.40  
  Billups, Chauncey         3.11   -1.73    1.38  
  Duncan, Tim               0.69    0.61    1.30  
  Thomas, Kurt             -0.39    1.68    1.28  
  Douglas-Roberts, Chris    0.62    0.61    1.23  
  Bynum, Will               1.27   -0.04    1.23  
  Martin, Cartier           1.01    0.21    1.22  
  Sessions, Ramon           1.41   -0.19    1.22  
  Pachulia, Zaza           -0.37    1.52    1.16  
  Williams, Deron           2.59   -1.44    1.14  
  Brown, Kwame             -0.15    1.28    1.13  
  Lee, Courtney             0.87    0.18    1.05  
  Scalabrine, Brian         0.30    0.76    1.05  
  Bynum, Andrew            -0.21    1.20    0.98  
  Scola, Luis               0.27    0.70    0.98  
  Randolph, Zach            0.56    0.40    0.96  
  Bass, Brandon             1.62   -0.67    0.95  
  House, Eddie              1.10   -0.18    0.92  
  Okafor, Emeka            -0.13    1.02    0.90  
  Foye, Randy               2.39   -1.50    0.89  
  Hamilton, Richard         0.02    0.86    0.88  
  Gibson, Daniel            0.58    0.29    0.88  
  Anderson, Ryan            0.07    0.80    0.86  
  Walton, Luke             -0.27    1.10    0.83  
  Mbah a Moute, Luc        -1.00    1.81    0.81  
  Young, Nick              -0.43    1.22    0.79  
  Songaila, Darius         -0.34    1.13    0.78  
  Miller, Brad              1.25   -0.47    0.77  
  Terry, Jason              1.21   -0.43    0.77  
  Westbrook, Russell        0.02    0.75    0.77  
  Blount, Mark              0.39    0.36    0.75  
  Thompson, Jason           0.29    0.46    0.75  
  Jack, Jarrett             1.03   -0.29    0.74  
  Blatche, Andray          -0.56    1.29    0.74  
  O'Neal, Shaquille         2.50   -1.80    0.70  
  Acker, Alex               0.36    0.32    0.68  
  Jones, James              0.49    0.17    0.66  
  Harpring, Matt           -0.53    1.16    0.64  
  Amundson, Louis           0.17    0.46    0.63  
  Mensah-Bonsu, Pops       -0.34    0.96    0.63  
  Deng, Luol               -0.79    1.41    0.61  
  Brewer, Corey            -0.38    0.99    0.61  
  Afflalo, Arron            0.69   -0.08    0.60  
  Diaw, Boris               0.22    0.37    0.59  
  Ajinca, Alexis           -0.22    0.78    0.56  
  Battie, Tony             -0.67    1.20    0.53  
  Williams, Shawne         -0.61    1.12    0.52  
  Voskuhl, Jake             0.33    0.15    0.48  
  Hunter, Othello          -0.09    0.57    0.48  
  Miller, Andre             0.72   -0.25    0.47  
  Ariza, Trevor            -0.02    0.48    0.46  
  Ross, Quinton            -1.36    1.80    0.44  
  Carter, Vince             2.43   -2.00    0.44  
  Harris, Devin             1.54   -1.11    0.43  
  Daniels, Marquis         -0.69    1.11    0.42  
  Nichols, Demetris         0.03    0.39    0.42  
  Dalembert, Samuel        -0.44    0.85    0.41  
  Murphy, Troy              2.19   -1.78    0.40  
  Knight, Brevin           -2.64    3.03    0.39  
  Arenas, Gilbert           0.36    0.03    0.39  
  Jackson, Bobby            0.70   -0.31    0.39  
  Fesenko, Kyrylo           0.50   -0.12    0.38  
  Crawford, Joe            -0.08    0.44    0.35  
  Allen, Tony              -1.81    2.16    0.35  
  Allen, Malik             -0.39    0.73    0.34  
  Hill, George             -0.38    0.72    0.34  
  Tucker, Alando            0.60   -0.26    0.34  
  Stoudemire, Amare        -0.95    1.28    0.34  
  Singleton, James         -0.70    1.03    0.33  
  Morris, Randolph          0.37   -0.04    0.33  
  Williams, Shelden        -0.29    0.60    0.32  
  Horford, Al               0.00    0.32    0.32  
  Wright, Antoine           1.89   -1.58    0.30  
  Jones, Dwayne             0.04    0.26    0.30  
  Posey, James              0.03    0.27    0.30  
  Dudley, Jared             0.83   -0.54    0.29  
  Gardner, Thomas          -0.94    1.22    0.28  
  Buckner, Greg            -0.18    0.45    0.27  
  Jackson, Stephen          1.41   -1.15    0.26  
  Humphries, Kris           0.44   -0.18    0.26  
  Bell, Raja                0.09    0.15    0.24  
  Jones, Damon              0.63   -0.40    0.23  
  Felton, Raymond          -0.52    0.75    0.23  
  Farmer, Desmon            0.40   -0.18    0.22  
  Richardson, Quentin       0.36   -0.15    0.21  
  Brown, Devin             -1.28    1.49    0.21  
  Chalmers, Mario           0.01    0.19    0.20  
  Rose, Malik              -0.40    0.60    0.20  
  Hill, Steven              0.03    0.16    0.19  
  Milicic, Darko           -0.80    1.00    0.19  
  Madsen, Mark             -0.43    0.62    0.18  
  Wright, Julian           -1.04    1.22    0.18  
  Morrow, Anthony           1.92   -1.75    0.18  
  Barnes, Matt              1.72   -1.54    0.18  
  Ahearn, Blake            -0.18    0.36    0.18  
  Samb, Cheikh             -0.40    0.56    0.17  
  Sene, Mouhamed            0.08    0.08    0.16  
  Wright, Brandan           0.23   -0.08    0.15  
  Graham, Stephen          -0.82    0.95    0.13  
  Korver, Kyle             -0.01    0.13    0.12  
  White, D.J.               0.42   -0.30    0.12  
  Williams, Jawad          -0.08    0.19    0.11  
  Udrih, Beno               0.30   -0.19    0.11  
  Villanueva, Charlie       1.33   -1.23    0.10  
  Haywood, Brendan         -0.13    0.22    0.09  
  Herrmann, Walter          0.15   -0.08    0.07  
  Andersen, Chris           0.17   -0.11    0.07  
  Lopez, Brook              0.13   -0.06    0.06  
  Williams, Marcus         -0.12    0.18    0.06  
  Marion, Shawn            -0.44    0.50    0.06  
  James, Jerome             0.00    0.04    0.04  
  Bogans, Keith             0.42   -0.40    0.02  
  Giddens, J.R.            -0.15    0.16    0.01  
  Ginobili, Manu            0.91   -0.90    0.01  
  Sims, Courtney           -0.12    0.12    0.00  
  Hibbert, Roy             -0.92    0.91   -0.01  
  Augustin, D.J.            0.43   -0.45   -0.01  
  Belinelli, Marco         -0.55    0.53   -0.02  
  Redick, J.J.              0.26   -0.30   -0.04  
  Thomas, Kenny            -0.13    0.09   -0.04  
  Peterson, Morris         -0.14    0.08   -0.05  
  Gadzuric, Dan             0.80   -0.86   -0.06  
  Williams, MarcusE         0.14   -0.20   -0.06  
  Brown, Dee               -0.09    0.03   -0.06  
  Collison, Nick           -0.84    0.78   -0.06  
  Duhon, Chris              0.33   -0.40   -0.07  
  Ruffin, Michael           0.03   -0.11   -0.08  
  Brooks, Aaron             1.17   -1.25   -0.08  
  Miles, C.J.               0.83   -0.92   -0.09  
  Stuckey, Rodney          -0.12    0.02   -0.10  
  Swift, Stromile          -0.78    0.68   -0.10  
  Diener, Travis            0.80   -0.92   -0.12  
  Boone, Josh               0.55   -0.67   -0.12  
  Pietrus, Mickael         -0.16    0.04   -0.13  
  Balkman, Renaldo         -0.60    0.47   -0.13  
  Conley, Mike             -0.88    0.75   -0.13  
  Azubuike, Kelenna        -0.38    0.24   -0.14  
  O'Bryant, Patrick        -1.61    1.47   -0.14  
  Davidson, Jermareo       -1.00    0.86   -0.15  
  Dorsey, Joey             -0.09   -0.06   -0.15  
  McRoberts, Josh          -0.12   -0.03   -0.15  
  Wright, Lorenzen         -0.61    0.46   -0.15  
  Mutombo, Dikembe          0.11   -0.26   -0.15  
  Krstic, Nenad            -0.98    0.82   -0.16  
  Hairston, Malik          -0.82    0.66   -0.16  
  Warrick, Hakim           -0.51    0.31   -0.20  
  Perkins, Kendrick         0.00   -0.20   -0.20  
  Jefferson, Dontell       -0.54    0.34   -0.20  
  Foyle, Adonal            -0.44    0.24   -0.20  
  Smith, Joe               -0.81    0.59   -0.21  
  Szczerbiak, Wally        -0.08   -0.16   -0.23  
  Claxton, Speedy          -0.12   -0.12   -0.24  
  McGrady, Tracy           -0.33    0.08   -0.25  
  McDyess, Antonio          1.22   -1.47   -0.25  
  Tolliver, Anthony        -0.43    0.17   -0.26  
  Webster, Martell         -0.03   -0.23   -0.26  
  Sharpe, Walter           -0.24   -0.02   -0.26  
  Jawai, Nathan            -0.27    0.00   -0.28  
  Brewer, Ronnie            0.30   -0.58   -0.28  
  Radmanovic, Vladimir      0.26   -0.55   -0.29  
  White, James             -0.27   -0.03   -0.29  
  Pruitt, Gabe             -1.57    1.25   -0.33  
  Brown, Shannon           -0.25   -0.08   -0.33  
  Jeffries, Jared          -0.80    0.46   -0.33  
  Curry, Eddy              -0.26   -0.09   -0.35  
  Outlaw, Travis            0.40   -0.75   -0.35  
  Baston, Maceo            -0.84    0.48   -0.35  
  Ford, T.J.               -0.07   -0.29   -0.36  
  Ager, Maurice            -0.75    0.39   -0.36  
  Williams, Sean            0.12   -0.49   -0.38  
  Barea, Jose              -0.09   -0.29   -0.38  
  Rush, Kareem              0.05   -0.44   -0.39  
  Cook, Daequan             0.68   -1.07   -0.39  
  Johnson, Trey            -0.25   -0.14   -0.40  
  Lee, David                1.38   -1.79   -0.41  
  Prince, Tayshaun          0.78   -1.19   -0.41  
  Pavlovic, Sasha           0.00   -0.43   -0.43  
  Brown, Andre             -0.34   -0.09   -0.44  
  Ratliff, Theo             0.72   -1.17   -0.44  
  Gray, Aaron              -1.07    0.63   -0.45  
  Quinn, Chris              0.36   -0.81   -0.45  
  Davis, Paul              -0.84    0.39   -0.46  
  Barbosa, Leandro          0.64   -1.10   -0.46  
  Watson, C.J.              0.79   -1.25   -0.46  
  Wright, Dorell           -0.92    0.46   -0.46  
  Law, Acie                -1.45    0.99   -0.47  
  Green, Willie            -0.04   -0.44   -0.48  
  Graham, Joey             -0.97    0.49   -0.48  
  Davis, Glen               0.56   -1.05   -0.49  
  Dragic, Goran             0.31   -0.81   -0.49  
  Finley, Michael           1.25   -1.75   -0.50  
  Johnson, Anthony         -0.86    0.36   -0.50  
  Mbenga, DJ               -0.96    0.46   -0.50  
  Ellis, Monta              0.16   -0.67   -0.51  
  Haslem, Udonis           -0.77    0.24   -0.52  
  Mobley, Cuttino          -0.35   -0.17   -0.52  
  Adams, Hassan            -0.27   -0.27   -0.54  
  Evans, Reggie             0.11   -0.65   -0.54  
  Douby, Quincy            -0.25   -0.30   -0.54  
  Elson, Francisco          0.07   -0.63   -0.56  
  Simmons, Cedric          -0.32   -0.24   -0.56  
  Lue, Tyronn              -1.60    1.04   -0.56  
  Jones, Fred               0.93   -1.49   -0.57  
  Bibby, Mike               0.80   -1.37   -0.57  
  Rose, Derrick             1.09   -1.66   -0.57  
  Randolph, Anthony         0.12   -0.71   -0.59  
  Vujacic, Sasha           -1.03    0.44   -0.59  
  Barry, Brent             -0.36   -0.24   -0.60  
  Carter, Anthony          -0.87    0.26   -0.61  
  Iverson, Allen           -1.96    1.33   -0.63  
  Swift, Robert            -0.05   -0.58   -0.63  
  Sefolosha, Thabo         -1.86    1.21   -0.65  
  Johnson, Linton          -0.56   -0.11   -0.67  
  Gasol, Marc               0.46   -1.14   -0.68  
  Butler, Caron             2.07   -2.75   -0.68  
  Gill, Eddie              -0.32   -0.37   -0.69  
  Bowen, Ryan              -0.29   -0.39   -0.69  
  Moore, Mikki             -0.57   -0.13   -0.70  
  Jefferson, Richard       -0.43   -0.26   -0.70  
  Alexander, Joe           -0.02   -0.69   -0.70  
  Ely, Melvin              -1.02    0.31   -0.71  
  Calderon, Jose            0.52   -1.26   -0.74  
  Booth, Calvin            -0.25   -0.51   -0.76  
  West, Mario              -0.76    0.00   -0.76  
  Beasley, Michael         -0.36   -0.42   -0.78  
  Carney, Rodney           -1.23    0.44   -0.78  
  Landry, Carl              0.01   -0.81   -0.79  
  Jamison, Antawn           0.64   -1.44   -0.80  
  Ollie, Kevin             -0.16   -0.65   -0.81  
  Ridnour, Luke            -1.10    0.29   -0.81  
  Brand, Elton             -2.50    1.69   -0.81  
  Koufos, Kosta            -1.19    0.37   -0.82  
  Mohammed, Nazr           -0.13   -0.70   -0.83  
  Dunleavy, Mike           -0.35   -0.55   -0.90  
  Kaman, Chris             -0.97    0.06   -0.91  
  Taylor, Mike             -0.65   -0.27   -0.92  
  Crawford, Jamal           1.90   -2.84   -0.94  
  Arthur, Darrell          -1.23    0.27   -0.96  
  Alston, Rafer            -0.88   -0.08   -0.96  
  Atkins, Chucky           -1.08    0.12   -0.96  
  Ukic, Roko               -2.02    1.05   -0.96  
  Collins, Jarron          -0.95   -0.02   -0.97  
  Biedrins, Andris         -1.04    0.07   -0.97  
  Bell, Charlie            -0.92   -0.12   -1.04  
  Green, Jeff              -0.07   -0.97   -1.05  
  Martin, Kevin             2.17   -3.23   -1.06  
  Jianlian, Yi             -0.78   -0.34   -1.12  
  Dampier, Erick           -0.85   -0.29   -1.14  
  Yue, Sun                 -0.41   -0.74   -1.14  
  Croshere, Austin         -1.13   -0.03   -1.16  
  Marbury, Stephon         -1.06   -0.13   -1.19  
  Hunter, Lindsey          -1.10   -0.10   -1.20  
  Stevenson, DeShawn       -0.47   -0.74   -1.21  
  Williams, Marvin         -0.40   -0.83   -1.23  
  Mihm, Chris              -0.77   -0.46   -1.23  
  Weems, Sonny             -1.08   -0.15   -1.24  
  Randolph, Shavlik        -0.55   -0.70   -1.25  
  Nelson, Demarcus         -1.51    0.26   -1.25  
  Diawara, Yakhouba        -1.58    0.32   -1.26  
  Livingston, Shaun        -0.44   -0.82   -1.26  
  O'Neal, Jermaine         -0.60   -0.69   -1.29  
  Maggette, Corey           0.16   -1.47   -1.30  
  Miller, Mike             -0.10   -1.24   -1.34  
  Davis, Baron             -0.91   -0.44   -1.35  
  Marks, Sean              -1.45    0.08   -1.37  
  Almond, Morris           -2.08    0.70   -1.38  
  Armstrong, Hilton        -1.76    0.37   -1.39  
  Singletary, Sean         -1.75    0.36   -1.39  
  Novak, Steve             -0.17   -1.23   -1.40  
  Rodriguez, Sergio        -1.06   -0.35   -1.42  
  Mayo, O.J.                0.55   -1.98   -1.43  
  Richardson, Jeremy       -0.99   -0.48   -1.47  
  Bowen, Bruce             -3.12    1.64   -1.47  
  Lowry, Kyle              -1.91    0.43   -1.49  
  McGuire, Dominic          0.22   -1.71   -1.49  
  Dixon, Juan              -0.96   -0.53   -1.49  
  Evans, Maurice           -0.25   -1.26   -1.52  
  Boozer, Carlos           -0.30   -1.26   -1.56  
  Speights, Marreese        0.41   -2.03   -1.62  
  Oberto, Fabricio         -1.44   -0.19   -1.62  
  Richardson, Jason         0.82   -2.45   -1.63  
  Price, Ronnie            -0.55   -1.09   -1.64  
  Vaughn, Jacque           -2.00    0.33   -1.67  
  Williams, Louis           0.18   -1.88   -1.70  
  Hayes, Chuck             -2.33    0.61   -1.72  
  Farmar, Jordan           -1.40   -0.33   -1.73  
  Pecherov, Oleksiy         0.15   -1.92   -1.77  
  Watson, Earl             -0.50   -1.28   -1.78  
  Gay, Rudy                -0.13   -1.65   -1.78  
  Kapono, Jason            -0.49   -1.31   -1.81  
  Gordon, Eric             -0.68   -1.15   -1.83  
  McCants, Rashad          -2.19    0.34   -1.86  
  Solomon, Willie          -1.54   -0.36   -1.90  
  Nesterovic, Rasho        -1.58   -0.33   -1.91  
  Chandler, Wilson         -0.51   -1.40   -1.91  
  Anthony, Joel            -1.98    0.05   -1.93  
  Cook, Brian              -1.56   -0.38   -1.94  
  Lopez, Robin             -1.14   -0.82   -1.96  
  Gooden, Drew             -2.06    0.08   -1.98  
  Stackhouse, Jerry        -1.89   -0.09   -1.99  
  Thomas, Etan             -1.12   -0.88   -2.00  
  Roberson, Anthony        -1.51   -0.50   -2.00  
  Miles, Darius            -1.84   -0.19   -2.03  
  Smith, Craig             -1.58   -0.46   -2.04  
  Bayless, Jerryd          -0.66   -1.39   -2.05  
  Kinsey, Tarence          -1.12   -0.95   -2.07  
  Maxiell, Jason           -0.38   -1.70   -2.08  
  Walker, Bill             -1.03   -1.14   -2.17  
  May, Sean                -2.07   -0.10   -2.17  
  Crittenton, Javaris      -0.09   -2.08   -2.18  
  Jones, Solomon           -1.60   -0.59   -2.19  
  Morrison, Adam           -1.09   -1.12   -2.20  
  Wilcox, Chris            -1.12   -1.11   -2.23  
  Howard, Juwan            -0.98   -1.27   -2.25  
  Wilkins, Damien          -2.14   -0.12   -2.26  
  Greene, Donte            -1.83   -0.43   -2.26  
  Love, Kevin              -1.07   -1.27   -2.34  
  Gortat, Marcin           -2.59    0.24   -2.35  
  Diogu, Ike               -0.91   -1.45   -2.36  
  Hassell, Trenton         -1.76   -0.73   -2.49  
  Green, Gerald            -2.12   -0.37   -2.49  
  Gomes, Ryan              -1.51   -1.04   -2.55  
  Hughes, Larry            -1.29   -1.33   -2.62  
  Najera, Eduardo          -2.39   -0.25   -2.64  
  Thomas, Tyrus            -2.42   -0.23   -2.64  
  Jackson, Darnell         -0.63   -2.03   -2.67  
  Banks, Marcus            -2.11   -0.56   -2.67  
  Diop, DeSagana           -0.75   -1.94   -2.68  
  Davis, Ricky             -1.34   -1.37   -2.71  
  Butler, Rasual           -1.28   -1.49   -2.77  
  Kurz, Rob                -2.49   -0.28   -2.78  
  Bargnani, Andrea         -0.09   -2.70   -2.78  
  Salmons, John             0.19   -2.99   -2.79  
  Brown, Bobby             -1.26   -1.55   -2.80  
  Jordan, DeAndre          -1.38   -1.44   -2.82  
  James, Mike              -2.28   -0.62   -2.90  
  Rush, Brandon            -1.63   -1.33   -2.96  
  Jones, Dahntay           -2.39   -0.60   -2.98  
  Ivey, Royal              -1.15   -1.85   -3.00  
  George, Devean           -1.59   -1.51   -3.10  
  Head, Luther             -0.91   -2.26   -3.17  
  Hart, Jason              -2.74   -0.49   -3.22  
  Dooling, Keyon           -0.73   -2.51   -3.25  
  Kleiza, Linas            -1.90   -1.40   -3.29  
  Skinner, Brian           -2.94   -0.46   -3.40  
  Garcia, Francisco        -1.96   -1.48   -3.44  
  Thornton, Al              0.12   -3.56   -3.44  
  Petro, Johan             -2.36   -1.09   -3.45  
  Carroll, Matt            -3.32   -0.13   -3.45  
  Collins, Jason           -2.90   -0.58   -3.48  
  Durant, Kevin            -1.41   -2.09   -3.50  
  Hawes, Spencer           -1.04   -2.47   -3.51  
  McGee, JaVale            -1.01   -2.62   -3.63  
  Frye, Channing           -1.75   -1.96   -3.71  
  Hickson, J.J.            -2.09   -1.63   -3.72  
  Powell, Josh             -2.22   -1.56   -3.78  
  Daniels, Antonio         -1.85   -2.68   -4.53  
@KwameBeanJordan

This seems to confirm your latest findings. I've checked other sources too and it's similar enough (not "somewhat similar" like before).

@mystic

I can confirm now "weight" doesn't need to be matrix like I said before.
You were right that standardize=FALSE almost completely solve the problem I mentioned in the first place. Nice finding. Thanks again.
perma, how did you get the splits for ORAPM and DRAPM? I was able to run your code with some modifications on basketballvalue's 2011 data (no playoffs), but it produced all-in RAPM, not O and D split.
permaximum
Posts: 416
Joined: Tue Nov 27, 2012 7:04 pm

Re: Setting Up Excel File for RAPM

Post by permaximum »

nbacouchside wrote:perma, how did you get the splits for ORAPM and DRAPM? I was able to run your code with some modifications on basketballvalue's 2011 data (no playoffs), but it produced all-in RAPM, not O and D split.
While converting the data to regression-ready format; you have to double each matchup, completely reverse the lineups and only use offensive ratings of each lineup that's attacking, as the response. You're simply doubling the variables.
E,g:
O stands for Offense
D stands for Defense
Numbers is Player ID
O1, O2, O3, O4, O5, D6, D7, D8, D9, D10 - Offensive Rating (e,g: 500)
O6, O7, O8, O8, O10, D1, D2, D3, D4, D5 - Offensive Rating (e,g: 400)
permaximum
Posts: 416
Joined: Tue Nov 27, 2012 7:04 pm

Re: Setting Up Excel File for RAPM

Post by permaximum »

There have been people contacting me via pm or here in this thread or older threads about how to calculate RAPM and getting the data ready for regression in the past years. I assume there are still going to be some people interested in how to calculate RAPM whether they are forum members or they come from Google.

For that reason alone, I'm getting back to this thread. In one of the previous posts where I calculated the 2009 RAPM as an example, I mentioned using 10-times repeated 10-fold cross validation to come with a lambda. Well, although the intent was 10-times repeated 10-fold cross validation, the lambda was actually found out by just a normal 10-fold cross validation. Why? Because, R never sets a new seed number for calculations whether they're in a for loop or not. You have to manually give a new random seed for each kind of calculation regardless of anything in the code or you have to restart the program. I knew this before but it appears I didn't give any attention to it here in this thread while I was writing the R code and calculating the RAPM. Those results are still correct but variance is higher than we desire.

By repeating the 10-fold cross validation 10 times we reduce the variance greatly without introducing bias. We're simply averaging 10x more resamples. To be more accurate, we're taking mean CVM of each lambda value in 10 repeats. R's lambda sequence is not that great, so after 1 pass, (1-time running of the code without the manual sequence) I assign a manual lambda sequence to pick a better lambda. I layer this process and repeat it more than once to find an even more precise lambda. So, "lambda=seq(1, 1.14, by=0.001)" was found out that way.

Note: This is (10 x 10-fold cross validation) completely different than 100-fold cross validation.

As for the question of how do we give a random seed for each iteration of the cross validation process, in the for loop, I used set.seed function with some RNG code that took advantage of system time, process id and being in the loop (i).

Code: Select all

set.seed( as.integer((as.double(Sys.time())*i+Sys.getpid()) %% 2^31) )
So, here's the final code. First two columns of X are Poss (possessions colum for the weight argument) and Rtg (resulting offensive rating of a lineup in a matchup as the response. For more detail read the previous post) .

Code: Select all

R: 3.4.0
glmnet: 2.0.10
CV-method: 10-times repeated 10-fold cross-validation
Lambda: 1.037
The R Code:

Code: Select all

library(doParallel)
library(glmnet)
rapm <- read.table("c:/***/rapm2009.csv", sep=";", header=TRUE)
x <- as.matrix(rapm[c(-1,-2)])
y <- as.matrix(rapm[c("Rtg")])
lambdas = NULL
require(doParallel)
registerDoParallel(7)
for (i in 1:10)
{
    set.seed( as.integer((as.double(Sys.time())*i+Sys.getpid()) %% 2^31) )
    fit <- cv.glmnet(x,y,alpha=0,weights=rapm$Poss,nfolds=10,parallel=TRUE,standardize=FALSE,lambda=seq(1, 1.14, by=0.001))
    errors = data.frame(fit$lambda,fit$cvm)
    lambdas <- rbind(lambdas,errors)
}
lambdas <- aggregate(lambdas[, 2], list(lambdas$fit.lambda), mean)
bestindex = which(lambdas[2]==min(lambdas[2]))
bestlambda = lambdas[bestindex,1]
fit <- glmnet(x,y,alpha=0,weights=rapm$Poss,standardize=FALSE,lambda=bestlambda)
coef(fit)
2008-09 RAPM

Code: Select all

  Ranking           Player           O-RAPM   D-RAPM   RAPM   
 --------- ------------------------ -------- -------- ------- 
        1   James, LeBron              5.66     2.72    8.38  
        2   Odom, Lamar                3.13     4.66    7.79  
        3   Hinrich, Kirk              2.81     3.55    6.36  
        4   Paul, Chris                4.55     1.79    6.34  
        5   Bryant, Kobe               4.57     1.56    6.13  
        6   Wade, Dwayne               4.51     1.38    5.89  
        7   Smith, J.R.                4.06     1.74    5.80  
        8   Allen, Ray                 3.56     1.94    5.50  
        9   Howard, Dwight             3.12     2.37    5.49  
       10   Ming, Yao                  2.52     2.91    5.44  
       11   Wallace, Ben               2.46     2.42    4.88  
       12   Blake, Steve               4.12     0.65    4.77  
       13   West, Delonte              1.54     3.16    4.71  
       14   Lewis, Rashard             2.85     1.83    4.68  
       15   Nash, Steve                4.07     0.41    4.48  
       16   Duncan, Tim                2.64     1.76    4.40  
       17   Artest, Ron                1.73     2.67    4.39  
       18   Iguodala, Andre            2.10     2.18    4.28  
       19   Parker, Tony               3.72     0.55    4.27  
       20   Moon, Jamario              0.94     3.04    3.98  
       21   Hill, Grant                2.42     1.54    3.96  
       22   Gordon, Ben                3.72     0.22    3.93  
       23   West, David                2.24     1.59    3.82  
       24   Stojakovic, Peja           3.02     0.75    3.77  
       25   Aldridge, LaMarcus         3.35     0.39    3.75  
       26   Kirilenko, Andrei          1.45     2.27    3.72  
       27   Anthony, Carmelo           2.89     0.80    3.68  
       28   Nelson, Jameer             3.13     0.50    3.63  
       29   Bonner, Matt               1.48     2.13    3.62  
       30   Turkoglu, Hedo             1.40     2.18    3.58  
       31   Wallace, Gerald            1.14     2.42    3.56  
       32   Martin, Kenyon             0.71     2.72    3.43  
       33   Hilario, Nene              2.07     1.28    3.35  
       34   Billups, Chauncey          3.55    -0.25    3.30  
       35   Bynum, Andrew              1.85     1.40    3.26  
       36   Oden, Greg                 3.22    -0.02    3.20  
       37   Johnson, Amir             -0.20     3.39    3.19  
       38   Foster, Jeff               2.14     1.02    3.16  
       39   Fisher, Derek              1.54     1.57    3.12  
       40   Pierce, Paul               0.84     2.25    3.10  
       41   Camby, Marcus              0.05     3.04    3.09  
       42   Millsap, Paul              0.48     2.59    3.07  
       43   Roy, Brandon               3.06     0.01    3.07  
       44   Ilgauskas, Zydrunas        0.93     2.10    3.03  
       45   Garnett, Kevin             0.74     2.26    3.00  
       46   Jaric, Marko              -0.65     3.65    3.00  
       47   Johnson, Joe               2.62     0.34    2.96  
       48   Turiaf, Ronny              2.55     0.30    2.85  
       49   Gallinari, Danilo          1.79     1.05    2.84  
       50   Granger, Danny             3.82    -1.01    2.82  
       51   Smith, Josh                1.80     0.97    2.77  
       52   Kidd, Jason                0.80     1.89    2.69  
       53   Murray, Ronald (Flip)      1.32     1.31    2.62  
       54   Redd, Michael              3.79    -1.26    2.53  
       55   Ginobili, Manu             2.41     0.11    2.53  
       56   Gasol, Pau                 2.19     0.27    2.45  
       57   Haddadi, Hamed             0.97     1.46    2.43  
       58   Foye, Randy                2.97    -0.55    2.42  
       59   Battier, Shane            -0.14     2.53    2.39  
       60   Anderson, Ryan             0.56     1.81    2.38  
       61   Fernandez, Rudy            1.58     0.73    2.31  
       62   Redick, J.J.               2.19     0.12    2.31  
       63   Hollins, Ryan             -0.09     2.37    2.28  
       64   Mason, Roger               1.87     0.39    2.26  
       65   Stoudemire, Amare          0.72     1.50    2.22  
       66   Wright, Antoine            2.69    -0.47    2.22  
       67   Udoka, Ime                -0.65     2.86    2.21  
       68   Felton, Raymond            0.10     2.09    2.20  
       69   Villanueva, Charlie        2.91    -0.73    2.17  
       70   Wallace, Rasheed           1.36     0.80    2.17  
       71   Brown, Kwame               0.49     1.63    2.12  
       72   Bosh, Chris                2.51    -0.40    2.12  
       73   Barnes, Matt               2.09     0.03    2.11  
       74   Martin, Cartier            1.55     0.56    2.11  
       75   Parker, Anthony            0.69     1.37    2.06  
       76   Scalabrine, Brian          0.99     1.07    2.06  
       77   Young, Thaddeus           -0.52     2.53    2.01  
       78   Ellis, Monta               1.57     0.41    1.98  
       79   Lee, David                 4.00    -2.02    1.98  
       80   Bogut, Andrew             -0.93     2.90    1.98  
       81   Richardson, Quentin        1.93     0.05    1.97  
       82   Wafer, Von                 2.32    -0.38    1.95  
       83   Cardinal, Brian            0.61     1.31    1.93  
       84   Bass, Brandon              2.00    -0.09    1.91  
       85   Deng, Luol                -0.01     1.88    1.87  
       86   Robinson, Nate             0.87     0.98    1.84  
       87   Telfair, Sebastian         1.32     0.51    1.84  
       88   Davis, Glen                2.03    -0.24    1.79  
       89   Rondo, Rajon               0.67     1.10    1.77  
       90   Jack, Jarrett              2.76    -1.02    1.74  
       91   Batum, Nicolas             1.85    -0.11    1.73  
       92   Ariza, Trevor              0.82     0.86    1.69  
       93   Howard, Josh               1.02     0.64    1.67  
       94   Hayes, Jarvis              0.51     1.12    1.63  
       95   Thomas, Tim               -0.74     2.36    1.63  
       96   Nocioni, Andres            1.81    -0.19    1.62  
       97   Williams, Mo               1.67    -0.07    1.60  
       98   Scola, Luis                0.13     1.45    1.59  
       99   Pachulia, Zaza            -0.20     1.76    1.56  
      100   Powe, Leon                 0.30     1.25    1.55  
      101   Peterson, Morris           0.73     0.80    1.54  
      102   Williams, Deron            2.40    -0.94    1.46  
      103   Varejao, Anderson          1.17     0.28    1.45  
      104   Mensah-Bonsu, Pops         0.00     1.42    1.42  
      105   Wright, Julian            -0.70     2.10    1.39  
      106   Jackson, Stephen           2.12    -0.72    1.39  
      107   Marshall, Donyell          1.44    -0.08    1.36  
      108   Collins, Mardy             0.54     0.81    1.35  
      109   Noah, Joakim               0.55     0.79    1.33  
      110   Songaila, Darius           0.25     1.04    1.29  
      111   Young, Nick               -0.13     1.42    1.29  
      112   Okur, Mehmet               2.32    -1.06    1.26  
      113   Davis, Baron               0.67     0.58    1.25  
      114   Randolph, Zach             0.72     0.52    1.24  
      115   Pruitt, Gabe              -0.60     1.84    1.23  
      116   Miller, Brad               2.02    -0.83    1.18  
      117   O'Bryant, Patrick         -0.25     1.41    1.15  
      118   Dalembert, Samuel          0.49     0.66    1.15  
      119   Hunter, Othello            0.03     1.09    1.13  
      120   Kaman, Chris              -0.16     1.27    1.11  
      121   Dudley, Jared              0.42     0.68    1.10  
      122   Afflalo, Arron             1.11    -0.06    1.04  
      123   Magloire, Jamaal           0.66     0.37    1.03  
      124   Horford, Al                0.06     0.95    1.00  
      125   Warrick, Hakim             0.21     0.78    0.99  
      126   Jefferson, Al              0.64     0.34    0.98  
      127   Stuckey, Rodney           -0.29     1.27    0.98  
      128   Douglas-Roberts, Chris     0.24     0.74    0.97  
      129   Harris, Devin              2.23    -1.27    0.97  
      130   Gardner, Thomas           -0.91     1.86    0.95  
      131   Duhon, Chris              -0.06     0.96    0.90  
      132   Brewer, Corey              0.23     0.67    0.90  
      133   Posey, James              -0.48     1.38    0.90  
      134   Dunleavy, Mike             0.26     0.61    0.87  
      135   Green, Jeff                0.92    -0.09    0.83  
      136   Ford, T.J.                -0.13     0.96    0.83  
      137   Lue, Tyronn               -0.65     1.48    0.83  
      138   Sefolosha, Thabo          -1.09     1.91    0.81  
      139   Watson, C.J.               1.47    -0.66    0.81  
      140   Weaver, Kyle               0.77     0.04    0.81  
      141   Brewer, Ronnie             0.46     0.33    0.79  
      142   Bell, Raja                 0.10     0.62    0.73  
      143   Hill, George               0.25     0.47    0.71  
      144   Voskuhl, Jake              1.18    -0.50    0.68  
      145   Hughes, Larry              0.21     0.47    0.67  
      146   Maggette, Corey            0.92    -0.28    0.65  
      147   Calderon, Jose             2.12    -1.48    0.64  
      148   Thomas, Kurt              -1.11     1.73    0.63  
      149   Ely, Melvin               -0.14     0.76    0.61  
      150   Bynum, Will                0.91    -0.31    0.60  
      151   Carter, Vince              2.50    -1.90    0.60  
      152   Harpring, Matt            -0.41     1.01    0.60  
      153   Radmanovic, Vladimir       0.07     0.51    0.58  
      154   Nowitzki, Dirk             1.66    -1.09    0.57  
      155   Pavlovic, Sasha            0.01     0.54    0.55  
      156   Okafor, Emeka              0.36     0.19    0.55  
      157   Harrington, Al             1.49    -0.95    0.54  
      158   Bibby, Mike                1.60    -1.07    0.53  
      159   Jamison, Antawn            0.60    -0.07    0.53  
      160   Stevenson, DeShawn         0.70    -0.17    0.53  
      161   Chandler, Tyson            1.22    -0.69    0.53  
      162   Battie, Tony              -0.32     0.84    0.52  
      163   Murphy, Troy               2.27    -1.75    0.52  
      164   Sessions, Ramon            1.35    -0.85    0.50  
      165   Brown, Dee                 0.61    -0.13    0.48  
      166   Szczerbiak, Wally          0.66    -0.18    0.48  
      167   Conley, Mike              -0.31     0.77    0.46  
      168   Przybilla, Joel           -2.48     2.94    0.46  
      169   Bogans, Keith              0.57    -0.12    0.45  
      170   Lopez, Brook               0.89    -0.45    0.45  
      171   Jones, Dwayne              0.09     0.35    0.43  
      172   Mbah a Moute, Luc         -0.52     0.94    0.42  
      173   Jefferson, Dontell        -0.52     0.91    0.39  
      174   Salmons, John              1.67    -1.29    0.38  
      175   Blount, Mark               0.08     0.30    0.38  
      176   Hamilton, Richard         -0.21     0.57    0.37  
      177   Ross, Quinton             -0.52     0.88    0.36  
      178   Pietrus, Mickael          -0.30     0.66    0.36  
      179   Ollie, Kevin              -0.11     0.45    0.34  
      180   Crawford, Joe             -0.08     0.41    0.33  
      181   Iverson, Allen            -0.87     1.18    0.30  
      182   McGrady, Tracy             0.25     0.04    0.29  
      183   Singleton, James          -1.48     1.77    0.29  
      184   Boone, Josh                0.13     0.14    0.27  
      185   Williams, Marvin           0.91    -0.64    0.27  
      186   Tucker, Alando             0.92    -0.67    0.25  
      187   Williams, Marcus           0.21     0.03    0.24  
      188   Simmons, Bobby             0.99    -0.76    0.23  
      189   Haywood, Brendan           0.30    -0.08    0.23  
      190   Sene, Mouhamed             0.06     0.13    0.19  
      191   Fesenko, Kyrylo            0.59    -0.44    0.15  
      192   James, Jerome             -0.03     0.17    0.14  
      193   Allen, Malik              -0.28     0.41    0.13  
      194   Beasley, Michael           0.51    -0.38    0.13  
      195   Humphries, Kris           -0.01     0.14    0.13  
      196   Giddens, J.R.             -0.18     0.31    0.13  
      197   Blatche, Andray           -0.20     0.33    0.13  
      198   Farmer, Desmon             0.20    -0.07    0.12  
      199   Morris, Randolph           0.38    -0.26    0.12  
      200   Bowen, Ryan               -0.60     0.71    0.11  
      201   Johnson, Anthony          -0.58     0.69    0.11  
      202   Mason, Desmond            -0.86     0.97    0.11  
      203   Arenas, Gilbert            0.46    -0.36    0.11  
      204   Hill, Steven               0.02     0.09    0.10  
      205   Collison, Nick            -0.32     0.40    0.08  
      206   O'Neal, Jermaine           0.75    -0.68    0.07  
      207   Miller, Andre              0.84    -0.78    0.07  
      208   Smith, Joe                -1.05     1.11    0.07  
      209   Williams, Jawad           -0.31     0.37    0.06  
      210   Jones, James              -0.82     0.87    0.04  
      211   Lee, Courtney             -0.44     0.48    0.04  
      212   Baston, Maceo             -0.02     0.03    0.00  
      213   McRoberts, Josh           -0.47     0.46    0.00  
      214   Marion, Shawn              0.34    -0.34    0.00  
      215   Chalmers, Mario           -0.07     0.06   -0.01  
      216   Williams, MarcusE          0.26    -0.28   -0.03  
      217   Amundson, Louis           -0.52     0.48   -0.03  
      218   Ajinca, Alexis            -0.50     0.46   -0.04  
      219   Mbenga, DJ                -0.83     0.79   -0.04  
      220   Sharpe, Walter            -0.25     0.21   -0.04  
      221   White, James              -0.22     0.18   -0.04  
      222   Westbrook, Russell         0.23    -0.29   -0.06  
      223   Ahearn, Blake             -0.24     0.16   -0.08  
      224   Knight, Brevin            -2.35     2.27   -0.08  
      225   Curry, Eddy               -0.08    -0.03   -0.11  
      226   Dorsey, Joey              -0.06    -0.05   -0.11  
      227   Outlaw, Travis            -0.65     0.52   -0.13  
      228   Davidson, Jermareo        -1.09     0.95   -0.13  
      229   Haslem, Udonis            -0.20     0.06   -0.14  
      230   Jawai, Nathan             -0.30     0.16   -0.15  
      231   Claxton, Speedy           -0.11    -0.06   -0.17  
      232   Thomas, Kenny             -0.58     0.40   -0.18  
      233   Nichols, Demetris         -0.24     0.06   -0.18  
      234   Daniels, Marquis          -1.81     1.61   -0.20  
      235   Cook, Brian               -0.20     0.00   -0.20  
      236   Sims, Courtney            -0.18    -0.03   -0.21  
      237   Williams, Shawne          -1.09     0.86   -0.23  
      238   Graham, Stephen           -1.79     1.56   -0.23  
      239   Ruffin, Michael           -0.43     0.16   -0.27  
      240   Walton, Luke              -0.51     0.23   -0.28  
      241   Jones, Damon               0.87    -1.15   -0.28  
      242   McDyess, Antonio           1.02    -1.34   -0.32  
      243   Buckner, Greg             -0.33    -0.04   -0.37  
      244   Samb, Cheikh              -0.77     0.41   -0.37  
      245   Brown, Andre              -0.44     0.06   -0.37  
      246   Rose, Malik               -1.00     0.63   -0.37  
      247   Crawford, Jamal            1.58    -1.96   -0.38  
      248   Gibson, Daniel            -0.14    -0.24   -0.38  
      249   Johnson, Trey             -0.13    -0.27   -0.39  
      250   Green, Willie             -1.50     1.07   -0.43  
      251   Herrmann, Walter          -0.81     0.37   -0.44  
      252   Wright, Lorenzen          -0.96     0.51   -0.45  
      253   Howard, Juwan             -0.16    -0.29   -0.45  
      254   Moore, Mikki              -0.06    -0.40   -0.46  
      255   Mutombo, Dikembe           0.23    -0.68   -0.46  
      256   Butler, Caron              2.33    -2.79   -0.46  
      257   Adams, Hassan             -0.44    -0.03   -0.47  
      258   Acker, Alex                0.19    -0.67   -0.48  
      259   Ukic, Roko                -2.15     1.66   -0.49  
      260   Webster, Martell          -0.03    -0.46   -0.49  
      261   Terry, Jason               0.43    -0.92   -0.49  
      262   Gadzuric, Dan              0.55    -1.06   -0.50  
      263   Alston, Rafer              0.92    -1.47   -0.55  
      264   Bowen, Bruce              -2.62     2.07   -0.55  
      265   Weems, Sonny              -0.51    -0.07   -0.58  
      266   Augustin, D.J.            -0.04    -0.54   -0.58  
      267   Brown, Devin              -1.10     0.51   -0.59  
      268   Tolliver, Anthony         -0.94     0.35   -0.59  
      269   Williams, Shelden         -1.18     0.56   -0.63  
      270   Diaw, Boris               -0.03    -0.66   -0.68  
      271   Balkman, Renaldo          -1.52     0.83   -0.69  
      272   Arthur, Darrell           -1.56     0.86   -0.70  
      273   Armstrong, Hilton         -2.01     1.31   -0.70  
      274   Krstic, Nenad             -0.90     0.20   -0.70  
      275   Almond, Morris            -1.60     0.89   -0.71  
      276   Azubuike, Kelenna         -0.48    -0.23   -0.71  
      277   Gill, Eddie               -0.55    -0.17   -0.71  
      278   Lowry, Kyle               -1.35     0.63   -0.72  
      279   House, Eddie               0.19    -0.92   -0.72  
      280   O'Neal, Shaquille          2.56    -3.29   -0.73  
      281   Ratliff, Theo              0.11    -0.86   -0.76  
      282   Boozer, Carlos             0.35    -1.11   -0.76  
      283   Korver, Kyle               0.60    -1.37   -0.78  
      284   Williams, Sean             0.06    -0.86   -0.79  
      285   Evans, Reggie             -0.09    -0.72   -0.81  
      286   Mihm, Chris               -0.45    -0.36   -0.81  
      287   Yue, Sun                  -0.42    -0.39   -0.82  
      288   Oberto, Fabricio          -0.64    -0.19   -0.83  
      289   Novak, Steve               0.03    -0.86   -0.83  
      290   Mohammed, Nazr             0.11    -0.95   -0.84  
      291   West, Mario               -0.54    -0.31   -0.85  
      292   Wright, Dorell            -1.17     0.31   -0.86  
      293   McGuire, Dominic           0.25    -1.14   -0.89  
      294   Cook, Daequan             -0.37    -0.54   -0.91  
      295   Belinelli, Marco          -1.35     0.43   -0.92  
      296   Miles, C.J.               -0.06    -0.87   -0.93  
      297   Dragic, Goran              0.19    -1.12   -0.93  
      298   Madsen, Mark              -0.98     0.04   -0.93  
      299   Rush, Kareem              -0.71    -0.25   -0.96  
      300   Simmons, Cedric           -0.35    -0.61   -0.97  
      301   Croshere, Austin          -0.97     0.00   -0.97  
      302   Foyle, Adonal             -1.00     0.02   -0.98  
      303   Udrih, Beno                0.48    -1.52   -1.04  
      304   Jackson, Bobby            -1.10     0.03   -1.07  
      305   Marks, Sean               -0.71    -0.37   -1.08  
      306   Mobley, Cuttino           -0.97    -0.11   -1.08  
      307   Thompson, Jason           -1.19     0.11   -1.08  
      308   Jeffries, Jared           -2.28     1.18   -1.10  
      309   Allen, Tony               -2.25     1.12   -1.13  
      310   Randolph, Anthony         -0.32    -0.82   -1.14  
      311   Rose, Derrick              0.80    -1.94   -1.15  
      312   Ridnour, Luke             -1.96     0.81   -1.15  
      313   Hibbert, Roy              -1.82     0.67   -1.15  
      314   Richardson, Jason          1.48    -2.64   -1.16  
      315   Collins, Jarron           -1.17     0.01   -1.17  
      316   Anthony, Joel             -1.30     0.13   -1.18  
      317   Barry, Brent              -0.97    -0.21   -1.18  
      318   Elson, Francisco          -0.29    -0.91   -1.20  
      319   White, D.J.                0.05    -1.26   -1.21  
      320   Richardson, Jeremy        -0.91    -0.31   -1.22  
      321   Brooks, Aaron              0.07    -1.31   -1.24  
      322   Atkins, Chucky            -1.49     0.21   -1.27  
      323   Kinsey, Tarence            0.02    -1.30   -1.28  
      324   Butler, Rasual            -0.23    -1.07   -1.30  
      325   Thomas, Etan              -0.68    -0.65   -1.32  
      326   Farmar, Jordan            -1.43     0.10   -1.33  
      327   Gasol, Marc                0.57    -1.94   -1.36  
      328   Johnson, Linton           -0.88    -0.49   -1.37  
      329   Randolph, Shavlik         -0.26    -1.13   -1.38  
      330   Miller, Mike               0.58    -1.97   -1.39  
      331   Brand, Elton              -1.68     0.29   -1.39  
      332   Swift, Robert             -0.58    -0.81   -1.39  
      333   Graham, Joey              -1.17    -0.24   -1.41  
      334   Barea, Jose               -0.43    -1.00   -1.42  
      335   Perkins, Kendrick         -1.06    -0.37   -1.44  
      336   Gray, Aaron               -1.59     0.14   -1.45  
      337   Gay, Rudy                 -0.34    -1.11   -1.45  
      338   Barbosa, Leandro           0.70    -2.15   -1.45  
      339   Nelson, Demarcus          -1.58     0.11   -1.47  
      340   Jefferson, Richard        -0.79    -0.69   -1.48  
      341   Booth, Calvin             -0.14    -1.38   -1.52  
      342   Marbury, Stephon          -2.33     0.76   -1.57  
      343   Jianlian, Yi              -1.28    -0.29   -1.57  
      344   Wright, Brandan           -0.47    -1.10   -1.57  
      345   Watson, Earl              -0.62    -0.97   -1.59  
      346   Gortat, Marcin            -1.98     0.38   -1.60  
      347   Morrison, Adam            -0.91    -0.70   -1.61  
      348   Diener, Travis             0.74    -2.39   -1.64  
      349   Andersen, Chris           -0.65    -1.00   -1.65  
      350   Quinn, Chris               0.80    -2.45   -1.65  
      351   Brown, Shannon            -0.65    -1.00   -1.65  
      352   Bell, Charlie             -1.43    -0.25   -1.68  
      353   Walker, Bill              -0.87    -0.83   -1.70  
      354   Hairston, Malik           -1.39    -0.34   -1.73  
      355   Douby, Quincy             -0.46    -1.27   -1.73  
      356   Ager, Maurice             -1.90     0.10   -1.80  
      357   Mayo, O.J.                 1.09    -2.89   -1.80  
      358   Stackhouse, Jerry         -2.01     0.19   -1.82  
      359   Biedrins, Andris          -1.31    -0.51   -1.82  
      360   Dixon, Juan               -2.31     0.46   -1.84  
      361   Law, Acie                 -2.50     0.65   -1.85  
      362   Diogu, Ike                -0.32    -1.57   -1.88  
      363   Davis, Paul               -1.06    -0.84   -1.90  
      364   Landry, Carl              -0.93    -1.04   -1.97  
      365   Speights, Marreese         0.09    -2.10   -2.01  
      366   Maxiell, Jason            -0.99    -1.05   -2.04  
      367   Hunter, Lindsey           -1.44    -0.64   -2.08  
      368   Kapono, Jason             -1.00    -1.13   -2.13  
      369   Livingston, Shaun         -1.05    -1.09   -2.14  
      370   Kleiza, Linas             -0.70    -1.45   -2.14  
      371   McCants, Rashad           -1.96    -0.20   -2.16  
      372   Singletary, Sean          -2.00    -0.16   -2.16  
      373   Diop, DeSagana            -0.79    -1.38   -2.17  
      374   Smith, Craig              -1.27    -0.91   -2.18  
      375   Swift, Stromile           -1.57    -0.62   -2.20  
      376   Lopez, Robin              -1.40    -0.80   -2.20  
      377   Petro, Johan              -1.80    -0.41   -2.20  
      378   Milicic, Darko            -2.08    -0.13   -2.21  
      379   Gooden, Drew              -2.03    -0.19   -2.22  
      380   Prince, Tayshaun           0.21    -2.43   -2.22  
      381   Taylor, Mike              -1.56    -0.66   -2.22  
      382   Pecherov, Oleksiy         -0.64    -1.59   -2.23  
      383   Jones, Solomon            -1.89    -0.35   -2.24  
      384   Solomon, Willie           -1.29    -0.95   -2.25  
      385   Dampier, Erick            -0.41    -1.88   -2.29  
      386   Vujacic, Sasha            -2.30    -0.03   -2.33  
      387   Martin, Kevin              1.40    -3.73   -2.34  
      388   Gordon, Eric              -1.04    -1.32   -2.36  
      389   Jones, Fred               -0.07    -2.35   -2.42  
      390   Carter, Anthony           -2.02    -0.44   -2.46  
      391   Wilcox, Chris             -1.04    -1.45   -2.49  
      392   Price, Ronnie             -1.07    -1.42   -2.50  
      393   Vaughn, Jacque            -3.11     0.61   -2.50  
      394   Collins, Jason            -2.29    -0.21   -2.50  
      395   Finley, Michael            0.23    -2.74   -2.51  
      396   Diawara, Yakhouba         -2.07    -0.45   -2.52  
      397   Wilkins, Damien           -2.14    -0.39   -2.54  
      398   May, Sean                 -2.01    -0.53   -2.55  
      399   Love, Kevin               -1.67    -0.94   -2.61  
      400   Koufos, Kosta             -1.99    -0.66   -2.65  
      401   Alexander, Joe            -1.20    -1.48   -2.68  
      402   Bargnani, Andrea           0.08    -2.77   -2.69  
      403   Greene, Donte             -2.36    -0.33   -2.70  
      404   James, Mike               -2.34    -0.41   -2.75  
      405   Banks, Marcus             -2.18    -0.57   -2.75  
      406   Roberson, Anthony         -1.52    -1.25   -2.77  
      407   Hassell, Trenton          -0.85    -1.93   -2.79  
      408   Davis, Ricky              -2.44    -0.35   -2.79  
      409   Miles, Darius             -1.98    -0.86   -2.85  
      410   Rodriguez, Sergio         -2.34    -0.51   -2.85  
      411   Morrow, Anthony            1.44    -4.29   -2.85  
      412   Green, Gerald             -2.15    -0.83   -2.97  
      413   Hayes, Chuck              -3.59     0.59   -3.00  
      414   Daniels, Antonio          -1.45    -1.55   -3.00  
      415   Jackson, Darnell          -0.04    -2.98   -3.02  
      416   Durant, Kevin             -1.29    -1.84   -3.13  
      417   Hart, Jason               -2.75    -0.46   -3.21  
      418   Carroll, Matt             -3.44     0.16   -3.28  
      419   Carney, Rodney            -1.85    -1.43   -3.29  
      420   Jones, Dahntay            -2.11    -1.27   -3.38  
      421   Evans, Maurice            -2.49    -0.97   -3.46  
      422   Williams, Louis           -1.98    -1.50   -3.48  
      423   Gomes, Ryan               -2.01    -1.49   -3.51  
      424   Rush, Brandon             -1.90    -1.63   -3.53  
      425   Hickson, J.J.             -1.51    -2.16   -3.67  
      426   Head, Luther              -2.41    -1.35   -3.77  
      427   Najera, Eduardo           -2.96    -0.90   -3.86  
      428   Chandler, Wilson          -1.33    -2.57   -3.89  
      429   Brown, Bobby              -2.26    -1.67   -3.93  
      430   Thomas, Tyrus             -2.84    -1.12   -3.96  
      431   Powell, Josh              -2.95    -1.03   -3.99  
      432   Dooling, Keyon            -0.81    -3.29   -4.10  
      433   Crittenton, Javaris       -1.58    -2.64   -4.21  
      434   Thornton, Al              -0.19    -4.10   -4.29  
      435   Frye, Channing            -1.49    -2.87   -4.36  
      436   Kurz, Rob                 -3.49    -1.01   -4.50  
      437   George, Devean            -2.52    -2.03   -4.55  
      438   Ivey, Royal               -2.74    -1.86   -4.60  
      439   Garcia, Francisco         -1.94    -2.71   -4.66  
      440   Hawes, Spencer            -1.91    -3.14   -5.06  
      441   Jordan, DeAndre           -2.35    -2.77   -5.12  
      442   McGee, JaVale             -2.76    -2.39   -5.15  
      443   Nesterovic, Rasho         -3.21    -2.02   -5.22  
      444   Bayless, Jerryd           -2.57    -2.77   -5.34  
      445   Skinner, Brian            -4.16    -1.53   -5.69  
In the same time, I'm happy that this has been a good research for the value of repeating the k-fold CV and minimizing the variance... or even in the case of marginally reducing the bias. If you compare the previous results with the new ones, although they are in core similar, rankings and values have changed noticably and if you run the code more than once you'll get "nearly" identical lambda values and results. If we did LOOCV instead of repeated k-fold cross validation there would be 0 bias and results would always be the same but the variance would be too great. That's why 10 x 10 fold cross validation is the way to go for any data with more than a few hundred observations.

If you see different RAPM results on the internet, it's largely because of the cross validation method if the play-by-play datas are accurate and very similar (even that is doubtful because of various reasons). That's why you should take RAPM results on the internet with a grain of salt.
DSMok1
Posts: 1119
Joined: Thu Apr 14, 2011 11:18 pm
Location: Maine
Contact:

Re: Setting Up Excel File for RAPM

Post by DSMok1 »

Thank you very much, permaximum. Having this code easily available and well explained is very useful!
Developer of Box Plus/Minus
APBRmetrics Forum Administrator
Twitter.com/DSMok1
rainmantrail
Posts: 41
Joined: Fri Dec 04, 2020 6:44 pm

Re: Setting Up Excel File for RAPM

Post by rainmantrail »

Just wanted to say thank you for sharing this stuff. It's super helpful!
Post Reply