Question: LAB: Regression with categorical predictors The nbaallelo_mlr.csv data base contains information on 126315 NBA games between 1947 and 2015. The columns report the points made
LAB: Regression with categorical predictors
The nbaallelo_mlr.csv data base contains information on 126315 NBA games between 1947 and 2015. The columns report the points made by one team, the Elo rating of that team coming into the game, the Elo rating of the team after the game, whether the team won or lost, and the points made by the opposing team.
- Load the data set into a data frame.
- Recode the categorical variable game_result into a dummy variable with prefix game_result.
- Use the ols function to perform a multiple regression with pts as the response variable and elo_i, game_result_W, and opp_pts, in that order, as the predictor variables.
- Create an analysis of variance table using the results of the multiple regression.
Ex: If the Elo rating of the team after the game, elo_n, is used instead of elo_i, the output is:
sum_sq df F PR(>F) elo_n 1.384812e+05 1.0 2440.029440 0.0 game_result_W 9.340871e+06 1.0 164585.471121 0.0 opp_pts 1.689391e+07 1.0 297669.387214 0.0 Residual 7.168588e+06 126310.0 NaN NaN
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
