def basic_linear(wine_set):
scat0 = seaborn.regplot(x="volatile_acidity", y="quality", fit_reg=True, data=wine_set)
plt.xlabel("Amount of volatile acidity in wine")
plt.ylabel("Quality level of wine (0-10 scale)")
plt.title("Association between the amount of volatile acidity in wine and the quality of wine")
plt.show()
# ----------- centering the explanatory variable by subrtacting the mean
f_acidity_mean = wine_set["volatile_acidity"].mean()
print("mean of the volatile acidity variable = ", f_acidity_mean)
wine_set["volatile_acidity"] = wine_set["volatile_acidity"] - f_acidity_mean
print("mean of the volatile acidity variable after normalization = ", wine_set["volatile_acidity"].mean())
print ("\nOLS regression model for the association between the amount of volatile acidity in wine and the quality of wine:")
model1 = smf.ols(formula="quality ~ volatile_acidity", data=wine_set)
results1 = model1.fit()
print(results1.summary())
# call(basic_linear)
# #___________________________________ Multiple Regression___________________________________________
regression_modeling.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录