Can't figure this out after many tries, running into issues with the dummy tables, sample data provided, original file much too long, thank you!
pts | elo_i | opp_pts | elo_n | game_result |
66 | 1300 | 68 | 1293.2767 | L |
68 | 1300 | 66 | 1306.7233 | W |
63 | 1300 | 47 | 1309.6521 | W |
47 | 1306.7233 | 63 | 1297.0712 | L |
33 | 1300 | 50 | 1279.6189 | L |
50 | 1300 | 33 | 1320.3811 | W |
53 | 1300 | 59 | 1294.8458 | L |
59 | 1300 | 53 | 1305.1542 | W |
51 | 1300 | 56 | 1295.3092 | L |
56 | 1300 | 51 | 1304.6908 | W |
60 | 1293.2767 | 71 | 1286.1534 | L |
71 | 1300 | 60 | 1307.1233 | W |
56 | 1295.3092 | 71 | 1277.9456 | L |
71 | 1320.3811 | 56 | 1337.7448 | W |
55 | 1294.8458 | 57 | 1288.4139 | L |
57 | 1309.6521 | 55 | 1316.084 | W |
53 | 1304.6908 | 49 | 1312.8473 | W |
49 | 1279.6189 | 53 | 1271.4624 | L |
75 | 1277.9456 | 81 | 1273.2786 | L |
81 | 1300 | 75 | 1304.667 | W |
73 | 1305.1542 | 65 | 1311.5032 | W |
65 | 1316.084 | 73 | 1309.735 | L |
63 | 1312.8473 | 68 | 1302.5988 | L |
68 | 1297.0712 | 63 | 1307.3197 | W |
73 | 1286.1534 | 71 | 1289.1691 | W |
71 | 1271.4624 | 73 | 1268.4468 | L |
54 | 1289.1691 | 62 | 1283.6519 | L |
Regression with categorical predictors The nbaallelo_mir.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. Convert the categorical variable gameresult into a dummy variable gameresult_W. Use the ols function to perform a multiple regression with pts as the response variable and elo_i, gameresultw, 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: . . de 1.0 1.0 PR(>F) 0.0 sum_50 1.384812e+05 9.340871e+06 1.689391e+07 7.168588e+06 elo_n game_result_W opp_pts Residual F 2440.029440 164585.471121 297669.387214 NaN 1.0 126310.0 0.0 NaN 202428.5727295 LAB ACTIVITY 13.17.1: Clone of LAB: Regression with categorical predictors 0/1 Downloadable files nbaallelo_mir.csv Download main.py Load default template. 2 6 1 # Import the necessary modules 3 nba = # Code to read in nbaallelo_mir.csv 4 5 # Recode the column game_result into a dummy variables with the prefix game_result 7 # Perform multiple linear regression with pts as the response variable and elo_i, game_result_w, ans opp_pts 8 # in that order, as the predictor variable 9 results = # Code to perform multiple regression using statsmodels ols 10 11 # Create an analysis of variance table 12 aov_table = 7 Code to create ANOVA table 13 14 # Print the analysis of variance table 15 print(aov_table) Regression with categorical predictors The nbaallelo_mir.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. Convert the categorical variable gameresult into a dummy variable gameresult_W. Use the ols function to perform a multiple regression with pts as the response variable and elo_i, gameresultw, 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: . . de 1.0 1.0 PR(>F) 0.0 sum_50 1.384812e+05 9.340871e+06 1.689391e+07 7.168588e+06 elo_n game_result_W opp_pts Residual F 2440.029440 164585.471121 297669.387214 NaN 1.0 126310.0 0.0 NaN 202428.5727295 LAB ACTIVITY 13.17.1: Clone of LAB: Regression with categorical predictors 0/1 Downloadable files nbaallelo_mir.csv Download main.py Load default template. 2 6 1 # Import the necessary modules 3 nba = # Code to read in nbaallelo_mir.csv 4 5 # Recode the column game_result into a dummy variables with the prefix game_result 7 # Perform multiple linear regression with pts as the response variable and elo_i, game_result_w, ans opp_pts 8 # in that order, as the predictor variable 9 results = # Code to perform multiple regression using statsmodels ols 10 11 # Create an analysis of variance table 12 aov_table = 7 Code to create ANOVA table 13 14 # Print the analysis of variance table 15 print(aov_table)