R^2が高すぎるとき なぜか?
重回帰分析にて
y = ax + bのを逆にするといけない。
間違えの例: R^2 = 0.97
y = ypred予測結果の数
X = sales_norm
mod = sm.OLS(y, X) # Describe model
res = mod.fit() # Fit model
print res.summary() # Summarize model
# show the intercept, etc
print res.params
# predict values - compare with y
ypred = res.predict(X)
正しい:R^2=0.74
y = sales_norm
X = np.array([prev_sales_norm, avg_max_temp_norm, avg_min_temp_norm, precipitation_norm, weekend_norm, weather_number_norm]).T
# COUNT
print np.array(X).shape, np.array(y).shape
X = sm.add_constant(X)
mod = sm.OLS(y, X) # Describe model
res = mod.fit() # Fit model
print res.summary() # Summarize model
# show the intercept, etc
print res.params
# predict values - compare with y
ypred = res.predict(X)