Python - StatsModels,OLS 置信区间

标签 python statsmodels

在 Statsmodels 中,我可以使用

import statsmodels.api as sm

X = np.array([22000, 13400, 47600, 7400, 12000, 32000, 28000, 31000, 69000, 48600])
y = np.array([0.62, 0.24, 0.89, 0.11, 0.18, 0.75, 0.54, 0.61, 0.92, 0.88])
X2 = sm.add_constant(X)
est = sm.OLS(y, X2)
est2 = est.fit()

然后使用打印一个漂亮的摘要

print(est2.summary())

并使用提取诸如 p 值之类的东西

est2.pvalues

可在此页面上找到 http://www.statsmodels.org/dev/generated/statsmodels.regression.linear_model.RegressionResults.html

但在摘要中有置信区间,我不知道如何提取这些置信区间,就像我处理 pvalues 一样。

除了在摘要中看到它们,我怎样才能得到这些置信区间?

最佳答案

est2.conf_int(alpha=0.05, cols=None)

另见 statsmodels manual .

关于Python - StatsModels,OLS 置信区间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44302099/

相关文章:

python - statsmodels adfuller() 中使用的回归方法?

python-3.x - statsmodels.tsa.stattools 中的 PACF 函数在使用 ywunbiased 时给出的数字大于 1?

python - 线性回归预测预测输入数据(测试数据),而不是测试结果

python - statsmodel ARIMA 能否使用外生变量预测 future 的多个步骤

python - 当我在 Python 中使用命令时,命令的运行与预期不同

python - 通过遍历字典创建列表

python - 在 python 3 中打开文件奇怪错误

python - Statsmodels - 负二项式不收敛,而 GLM 收敛

python - 尝试使用多线程并行化 python 算法并避免 GIL 限制

python - 用于国际化的 set_language 重定向 View 将不起作用