Chapter 11 Exercises: Regularized Adjusted Plus-Minus (RAPM)
Overview
These exercises cover the theoretical foundations and practical applications of RAPM, including regression fundamentals, ridge regularization, model implementation, and interpretation of player impact metrics. Problems progress from conceptual understanding to advanced analytical challenges.
Section A: Foundational Concepts (Exercises 1-8)
Exercise 1: Raw Plus-Minus Limitations
A player has the following stint data from a single game:
| Stint | Minutes | Team Pts | Opp Pts | Teammates (avg BPM) |
|---|---|---|---|---|
| 1 | 8 | 22 | 14 | +4.5 |
| 2 | 6 | 10 | 18 | -1.2 |
| 3 | 10 | 24 | 20 | +3.8 |
| 4 | 4 | 6 | 12 | -2.5 |
a) Calculate the raw plus-minus for each stint. b) Calculate the player's overall raw plus-minus for the game. c) Calculate the weighted average BPM of teammates during the player's minutes. d) Explain why raw plus-minus may not accurately reflect this player's individual contribution.
Exercise 2: Collinearity Understanding
Consider a team where Player A and Player B always appear on the court together. In 500 possessions, their lineup outscore opponents by 250 points.
a) What is the combined impact per 100 possessions? b) If we try to estimate individual contributions using OLS, why is there no unique solution? c) Provide three different (A, B) coefficient pairs that would yield the same fitted values. d) What additional data would help distinguish their individual contributions?
Exercise 3: Design Matrix Construction
Construct the design matrix row for the following stint:
Home Team Players: LeBron James, Anthony Davis, D'Angelo Russell, Austin Reaves, Rui Hachimura Away Team Players: Stephen Curry, Klay Thompson, Andrew Wiggins, Draymond Green, Kevon Looney
a) Write out the indicator variables using the {-1, 0, +1} coding convention. b) How many non-zero entries are in this row? c) What constraint exists on the sum of entries in any row? d) If the home team outscored the away team by 8 points in 10 possessions, what is the normalized response value?
Exercise 4: Regression Interpretation
A RAPM model produces the following coefficients for three players:
| Player | RAPM | Minutes Played |
|---|---|---|
| Player X | +5.2 | 2,400 |
| Player Y | +2.8 | 1,800 |
| Player Z | -1.5 | 2,600 |
a) Interpret Player X's RAPM coefficient in plain English. b) Estimate the total point differential contribution for each player over the season. c) If Player X played on a team that went +150 in point differential, approximately what percentage came from Player X? d) Why might Player Z have negative RAPM despite playing the most minutes?
Exercise 5: Variance and Sample Size
The standard error of raw plus-minus is approximately SE = (2.5 / sqrt(n)) * 100, where n is possessions.
a) Calculate the standard error for a player with 500 possessions. b) Calculate the standard error for a player with 2,000 possessions. c) If a player has observed +3.0 raw plus-minus with 800 possessions, construct a 95% confidence interval. d) How many possessions would be needed for a standard error of 2.0 points per 100 possessions?
Exercise 6: Condition Number Analysis
A simplified design matrix for 4 players across 5 stints produces:
X'X = | 100 90 80 10 | | 90 95 85 15 | | 80 85 90 20 | | 10 15 20 50 |
a) Why do the high correlations between columns 1-3 suggest collinearity problems? b) If the smallest eigenvalue of X'X is 0.5 and the largest is 200, calculate the condition number. c) Interpret what this condition number means for OLS estimation. d) How would adding a ridge penalty of lambda = 10 affect the condition number?
Exercise 7: OLS vs Ridge Comparison
Given the following data: - X'WX eigenvalues: [500, 200, 50, 2, 0.1] - Ridge penalty lambda = 25
a) Calculate the eigenvalues of (X'WX + lambda*I). b) Calculate the original condition number. c) Calculate the new condition number after ridge regularization. d) By what factor did regularization improve the condition number?
Exercise 8: Bayesian Interpretation
A Bayesian RAPM model uses: - Prior: beta ~ N(0, tau^2) with tau = 3.0 - Likelihood variance: sigma^2 = 100
a) Calculate the implied ridge penalty lambda = sigma^2 / tau^2. b) Interpret the prior in basketball terms. c) If a player's prior mean were +2.0 instead of 0, how would this change interpretation? d) Why might we use different priors for different types of players?
Section B: Ridge Regression Mechanics (Exercises 9-15)
Exercise 9: Ridge Solution Derivation
Starting from the ridge objective function:
L(beta) = ||y - X*beta||^2 + lambda * ||beta||^2
a) Take the derivative with respect to beta and set to zero. b) Solve for the ridge estimator. c) Show that when lambda = 0, this reduces to OLS. d) Show that as lambda approaches infinity, all coefficients approach zero.
Exercise 10: Shrinkage Factor
For a single-player simplified case with X'X = 100 and X'y = 50:
a) Calculate the OLS estimate. b) Calculate the ridge estimate with lambda = 20. c) Calculate the shrinkage factor (ridge estimate / OLS estimate). d) Plot how the ridge estimate changes as lambda varies from 0 to 100.
Exercise 11: Bias-Variance Tradeoff
A player's true RAPM is +4.0. Due to collinearity, OLS produces: - Mean estimate: +4.0 (unbiased) - Standard deviation: 8.0
Ridge regression with lambda = 50 produces: - Mean estimate: +3.2 (biased) - Standard deviation: 2.5
a) Calculate the bias of the ridge estimator. b) Calculate the MSE of the OLS estimator. c) Calculate the MSE of the ridge estimator. d) Which estimator is preferred and why?
Exercise 12: Cross-Validation Setup
You have 20,000 stints of data and want to select lambda using 5-fold cross-validation.
a) How many stints are in each fold? b) Describe the process for evaluating lambda = 100. c) If you test lambda values [10, 50, 100, 500, 1000], how many total model fits are required? d) What metric would you use to compare different lambda values?
Exercise 13: Effective Degrees of Freedom
The effective degrees of freedom for ridge regression is:
df(lambda) = trace(X(X'X + lambda*I)^(-1)X')
For a model with 100 players: a) What is df(0) (the OLS case)? b) What happens to df as lambda approaches infinity? c) If df(lambda) = 45, interpret this in terms of model complexity. d) How does df relate to the bias-variance tradeoff?
Exercise 14: Weighted Regression
Stints have different numbers of possessions:
| Stint | Possessions | Point Diff (per 100) |
|---|---|---|
| 1 | 5 | +20 |
| 2 | 15 | +8 |
| 3 | 8 | -5 |
| 4 | 25 | +3 |
a) Calculate the possession weights for each stint. b) Why should longer stints receive more weight? c) If all stints had equal weight, what would be the average point differential? d) What is the possession-weighted average point differential?
Exercise 15: Heterogeneous Regularization
Consider applying different penalties to different players based on minutes played:
| Player | Minutes | Suggested lambda |
|---|---|---|
| Star (2800 min) | 2,800 | 25 |
| Rotation (1400 min) | 1,400 | 100 |
| Bench (500 min) | 500 | 400 |
a) Why should bench players have larger lambda values? b) What relationship exists between minutes and optimal lambda? c) How would you implement this in the ridge penalty matrix? d) What are the advantages and disadvantages of heterogeneous regularization?
Section C: Model Implementation (Exercises 16-22)
Exercise 16: Data Preparation
You receive play-by-play data with the following format:
game_id, event_type, player_id, team_id, timestamp, points
a) Describe the steps to transform this into stint-level data. b) How do you identify when a stint ends? c) What challenges arise when tracking which players are on the court? d) How do you handle stints that span halftime or timeouts?
Exercise 17: Possession Estimation
Estimate possessions for a stint with: - Field goal attempts: 8 - Free throw attempts: 4 - Turnovers: 2 - Offensive rebounds: 2
Using the formula: Poss ≈ FGA + 0.44*FTA + TOV - ORB
a) Calculate estimated possessions. b) Why is the free throw coefficient 0.44 rather than 1.0? c) Why are offensive rebounds subtracted? d) What are the limitations of this possession estimate?
Exercise 18: Sparse Matrix Implementation
For a league with 500 players and 250,000 stints:
a) Calculate the dimensions of the full design matrix. b) How many non-zero entries are in each row? c) What percentage of the matrix is non-zero? d) Why is sparse matrix storage essential for this problem?
Exercise 19: Python Implementation
Write Python code to:
a) Create the design matrix from stint data with player indicators. b) Implement weighted ridge regression. c) Calculate predicted values for each stint. d) Compute the R-squared of the model.
Exercise 20: Cross-Validation Implementation
Implement k-fold cross-validation for RAPM:
a) Write code to split stints into k folds. b) Implement the training and validation loop. c) Calculate cross-validation error for each lambda. d) Select the optimal lambda.
Exercise 21: Offensive and Defensive Splits
Given stint data with both offensive and defensive efficiency:
| Stint | ORTG | DRTG | Net Rating |
|---|---|---|---|
| 1 | 115 | 105 | +10 |
| 2 | 98 | 110 | -12 |
| 3 | 108 | 108 | 0 |
a) Explain why ORTG and DRTG don't sum to Net Rating. b) Describe how to fit separate O-RAPM and D-RAPM models. c) What sign convention should D-RAPM use for interpretability? d) Why are O-RAPM and D-RAPM individually noisier than total RAPM?
Exercise 22: Multi-Year Implementation
You want to build a 3-year RAPM model with year weights [1.0, 0.8, 0.6] for current, previous, and two years ago.
a) How do you combine data from multiple seasons? b) How do you handle players who only appeared in some seasons? c) Implement the year-weighting in the possession weights. d) What assumptions does this approach make about player ability?
Section D: Interpretation and Application (Exercises 23-30)
Exercise 23: Converting to Wins
A player has RAPM = +4.5 and played 2,200 minutes. Using: - 2.0 minutes per 100 possessions - 2.7 points per win
a) Calculate total points added above replacement. b) Convert to wins added. c) If the player earned $25 million, calculate cost per win. d) How does uncertainty in RAPM affect this calculation?
Exercise 24: Confidence Intervals
A player has RAPM = +3.0 with estimated standard error of 1.8.
a) Construct a 95% confidence interval for true RAPM. b) Can we conclude this player is above average (RAPM > 0)? c) What sample size would narrow the interval to ±1.0? d) How should this uncertainty influence player evaluation?
Exercise 25: Comparing Players
Three players on the same team:
| Player | RAPM | SE | Minutes |
|---|---|---|---|
| A | +4.2 | 1.5 | 2,500 |
| B | +3.8 | 2.2 | 1,600 |
| C | +2.5 | 1.2 | 2,800 |
a) Which player has the most reliable estimate? b) Can we statistically distinguish Player A from Player B? c) Calculate total wins added for each player. d) If you could only keep one player, what factors would you consider?
Exercise 26: Teammate Effects
Player X has RAPM = +6.0 but always plays with an All-Star point guard (RAPM = +7.0).
a) How does collinearity affect our confidence in Player X's estimate? b) If Player X were traded to a team without elite guards, what might happen to their production? c) What evidence would suggest Player X's value is independent of the point guard? d) How do multi-year samples help address this concern?
Exercise 27: Replacement Level Adjustment
Standard RAPM uses league average (0) as baseline. To convert to replacement level (-2.5):
| Player | RAPM (avg baseline) |
|---|---|
| Star | +7.0 |
| Starter | +2.0 |
| Rotation | -0.5 |
| Bench | -2.0 |
a) Calculate RAPM relative to replacement level for each player. b) Which player is closest to replacement level? c) Why is replacement level more useful than league average for roster decisions? d) How is replacement level typically estimated?
Exercise 28: O-RAPM and D-RAPM Analysis
A player has O-RAPM = +5.5 and D-RAPM = -2.0 (total RAPM = +3.5).
a) Describe this player's archetype. b) What lineup construction maximizes this player's value? c) How should this player be used in late-game situations? d) Predict how this player's value changes as they age.
Exercise 29: Comparing Metrics
A player has the following advanced stats:
| Metric | Value | Percentile |
|---|---|---|
| RAPM | +2.5 | 75th |
| BPM | +4.0 | 82nd |
| RPM | +3.2 | 78th |
| WS/48 | .150 | 70th |
a) What might explain RAPM being lower than BPM? b) Why might RPM fall between RAPM and BPM? c) Which metric should be most trusted and why? d) How would you synthesize these metrics for player evaluation?
Exercise 30: Trade Evaluation
Team A is considering trading for Player X: - Player X: RAPM = +4.0, SE = 1.5, Age = 27, Salary = $20M - Giving up: Player Y (RAPM = +1.5, SE = 2.0) + Draft Pick
a) Calculate the expected RAPM upgrade. b) Account for uncertainty in both players' true values. c) What non-RAPM factors should influence this decision? d) How would you value the draft pick in RAPM terms?
Section E: Advanced Topics (Exercises 31-35)
Exercise 31: Interaction Effects
You want to estimate how well two players complement each other. The model becomes:
y = sum(beta_i * x_i) + sum(gamma_ij * x_i * x_j) + epsilon
a) How many interaction terms exist for 500 players? b) Why is strong regularization essential for interaction terms? c) If Player A has RAPM = +3.0 and Player B has RAPM = +2.0, but gamma_AB = +1.5, what is their combined impact? d) What basketball scenarios might produce positive or negative interactions?
Exercise 32: Time-Varying RAPM
A player's RAPM estimates by month:
| Month | RAPM | Games |
|---|---|---|
| Oct-Nov | +5.5 | 20 |
| Dec | +3.0 | 15 |
| Jan | +1.5 | 14 |
| Feb | +4.0 | 12 |
| Mar-Apr | +6.0 | 21 |
a) Calculate the simple average RAPM. b) Calculate the games-weighted average RAPM. c) What might explain the December-January dip? d) How would a time-varying model handle this data differently?
Exercise 33: Prior Specification
You're building a RAPM model with box-score priors. Historical analysis shows:
RAPM_predicted = 0.5 * BPM + 0.3
For a player with BPM = +4.0: a) Calculate the prior mean for RAPM. b) How should the prior variance relate to BPM's predictive accuracy? c) If this player has 500 possessions of RAPM data showing +1.0, estimate the posterior mean. d) When does the data overwhelm the prior?
Exercise 34: Luck Adjustment
Player X shot 42% from three on "open" looks (expected 38%). This added approximately +0.8 points per 100 possessions to their raw plus-minus.
a) Should RAPM be adjusted for three-point luck? b) How might tracking data help separate skill from luck? c) If we regress three-point shooting to expectation, what happens to Player X's RAPM? d) What are the arguments for and against luck adjustment?
Exercise 35: Projection Model
Build a projection for next season using: - Current RAPM: +4.0 - Prior year RAPM: +3.0 - Age: 28 - Age curve (decline per year after 27): -0.3
a) Calculate a simple weighted projection (60% current, 40% prior). b) Apply the age adjustment. c) What additional factors might improve the projection? d) How should projection uncertainty be communicated?
Section F: Comprehensive Problems (Exercises 36-40)
Exercise 36: Full Season Analysis
Given complete stint data for a team's season (data provided separately):
a) Prepare the data for RAPM modeling. b) Fit a ridge regression model with cross-validated lambda. c) Report RAPM, O-RAPM, and D-RAPM for all rotation players. d) Identify the most impactful lineup combinations. e) Compare your RAPM values to published metrics.
Exercise 37: Roster Construction
You have a $120M salary cap and need to build a competitive roster. Player pool includes:
| Tier | RAPM Range | Salary Range | Available |
|---|---|---|---|
| Superstar | +6 to +8 | $40-50M | 2 |
| All-Star | +3 to +5 | $25-35M | 5 |
| Quality Starter | +1 to +2 | $12-20M | 10 |
| Rotation | -1 to +1 | $5-10M | 15 |
| Minimum | -2 to 0 | $2M | Unlimited |
a) Design a roster maximizing total RAPM within cap constraints. b) Consider position requirements and playing time distribution. c) Account for uncertainty in RAPM estimates. d) What is the expected win total for your roster?
Exercise 38: Historical Comparison
Using historical RAPM data (or estimates):
a) Identify the top 10 single-season RAPM performances. b) Compare RAPM leaders to MVP voting results. c) Analyze how RAPM has evolved across eras. d) Discuss potential biases in historical RAPM estimation.
Exercise 39: Methodology Critique
A colleague proposes using Lasso (L1 penalty) instead of ridge (L2 penalty) for player impact estimation.
a) Explain the key difference between Lasso and ridge. b) What would Lasso regularization do to low-minute players? c) Is sparsity desirable in player impact models? d) When might elastic net (combined L1 and L2) be appropriate?
Exercise 40: Research Extension
Design an improved RAPM methodology addressing current limitations:
a) Identify the three most important limitations of standard RAPM. b) Propose specific methodological improvements for each. c) Describe the data requirements for your improvements. d) Outline an evaluation strategy to test whether your improvements work.
Answer Key Hints
Selected Answers:
Exercise 1b: Overall raw +/- = (22-14) + (10-18) + (24-20) + (6-12) = 8 - 8 + 4 - 6 = -2
Exercise 5a: SE = (2.5 / sqrt(500)) * 100 = 11.2 points per 100 possessions
Exercise 5d: Need (2.5 / sqrt(n)) * 100 = 2.0, so n = (250/2)^2 = 15,625 possessions
Exercise 10b: Ridge estimate = (X'X + lambda)^(-1) * X'y = (100 + 20)^(-1) * 50 = 50/120 = 0.417
Exercise 11c: MSE_ridge = bias^2 + variance = (4.0 - 3.2)^2 + (2.5)^2 = 0.64 + 6.25 = 6.89
Exercise 11d: Ridge is preferred because MSE_ridge (6.89) < MSE_OLS (0 + 64 = 64)
Exercise 14d: Weighted avg = (520 + 158 + 8(-5) + 253) / (5+15+8+25) = (100 + 120 - 40 + 75) / 53 = 4.81
Exercise 23b: Points added = 4.5 * (2200/200) = 49.5 points; Wins = 49.5/2.7 = 18.3 wins
Full solutions available in the instructor's manual.