Alexander Romero
Our data shows that a team with 49 wins has never missed the playoffs. What is the expected points difference for a team to make it to the postseason? Use the lecture solution file and more specifically the WingsReg model.
First thing first, my R notebook needs to read the data first!
# Read in the data
NBA = read.csv("NBA_train.csv")
str(NBA)
Point Differential
# Create a new column for point differential
NBA$PTS_DIFF = NBA$PTS - NBA$oppPTS
# Fit the WingsReg model: point differential predicted by wins
WingsReg = lm(PTS_DIFF ~ W, data = NBA)
# View summary (optional, for analysis)
summary(WingsReg)
Call:
lm(formula = PTS_DIFF ~ W, data = NBA)
Residuals:
Min 1Q Median 3Q Max
-378.45 -61.36 3.78 60.92 281.18
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1185.6517 10.6403 -111.4 <2e-16 ***
W 28.9183 0.2478 116.7 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 91.19 on 833 degrees of freedom
Multiple R-squared: 0.9423, Adjusted R-squared: 0.9423
F-statistic: 1.361e+04 on 1 and 833 DF, p-value: < 2.2e-16
# Create new data with 49 wins
new_team = data.frame(W = 49)
# Predict the point differential
predicted_diff = predict(WingsReg, newdata = new_team)
predicted_diff
1
231.3467