admin管理员组文章数量:1550529
说我在statsmodels中适合模型
mod = smf.ols('dependent ~ first_category + second_category + other', data=df).fit()
当我做mod.summary()时,我可能会看到以下内容:
Warnings:
[1] The condition number is large, 1.59e+05. This might indicate that there are
strong multicollinearity or other numerical problems.
有时警告是不同的(例如,基于设计矩阵的特征值).如何在变量中捕获高多重共线性条件?此警告是否存储在模型对象的某处?
另外,我在哪里可以找到summary()中字段的描述?
解决方法:
您可以通过检查相关矩阵的特征值来检测高多重共线性.非常低的特征值表明数据是共线的,并且相应的特征向量显示哪些变量是共线的.
如果数据中没有共线性,则可以预期没有任何特征值接近零:
>>> xs = np.random.randn(100, 5) # independent variables
>>> corr = np.corrcoef(xs, rowvar=0) # correlation matrix
>>> w, v = np.linalg.eig(corr) # eigen values & eigen vectors
>>> w
array([ 1.256 , 1.1937, 0.7273, 0.9516, 0.8714])
但是,如果说x [
本文标签: 线性Pythonstatsmodels
版权声明:本文标题:python检验多重共线性_python– 在statsmodels中捕获高多重共线性 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1727247073a1104755.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论