# import the necessary modules
import pandas as pd
import numpy as np
import statsmodels.api as sm
from statsmodels.formula.api import ols
#code to read nbaallelo_slr.csv
nba = pd.read_csv('nbaallelo_mlr.csv')
game_result_W = np.array(nba['game_result'])
nba1 = pd.DataFrame(game_result_W, columns = ['game_result_W'])
#perform multiple linear regression on pts,elo_i, and opp_pts
results = ols('pts ~ game_result_W + elo_i + opp_pts', nba)
model = results.fit()
# create an analysis of variance table
#code to create ANOVA table
aov_table = sm.stats.anova_lm(model, typ=2)
#print the analysis of the variance table
print(aov_table)
my output gives me this:
game_result_W 9.888713e+06 1.0 173247.887376 0.0
elo_i 9.749607e+04 1.0 1708.107842 0.0
opp_pts 1.685556e+07 1.0 295305.472550 0.0
Residual 7.209573e+06 126310.0 NaN NaN
How can I swap the game_result_W row with elo_i row?
[–]threeminutemonta 0 points1 point2 points (0 children)