比较决定系数
回顾一下,决定系数用于衡量线性回归直线对观测值的拟合程度。在线性回归中加入多个解释变量的一个重要动机是:与只用单个解释变量相比,您通常可以提高拟合效果。
在本练习中,您将比较 3 个台湾房价模型的决定系数,看看哪个模型的效果最好。
mdl_price_vs_conv、mdl_price_vs_age 和 mdl_price_vs_both 已作为拟合后的模型提供。
本练习是课程的一部分
Python 中级回归:使用 statsmodels
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Print the coeffs of determination for mdl_price_vs_conv
print("rsquared_conv: ", ____)
print("rsquared_adj_conv: ", ____)
# Print the coeffs of determination for mdl_price_vs_age
print("rsquared_age: ", ____)
print("rsquared_adj_age: ", ____)
# Print the coeffs of determination for mdl_price_vs_both
print("rsquared_both: ", ____)
print("rsquared_adj_both: ", ____)