【问题标题】:How to save in a variable significance of a coefficient estimated by OLS using statsmodels in python?如何在 Python 中使用 statsmodels 保存 OLS 估计的系数的变量显着性?
【发布时间】:2015-04-02 06:06:20
【问题描述】:

我使用 statsmodels.formula.api 执行了线性回归 (OLS),并通过以下方式显示参数和摘要:

 result = sm.ols(formula="items ~ views + price", data=nvo).fit()
 print result.params

这非常有用,但我想将价格系数的意义保存在变量中,如何访问摘要对象的元素?具体如何保存 R 平方、显着性和置信区间?

【问题讨论】:

    标签: python pandas statsmodels


    【解决方案1】:

    哦,我设法回答了我自己的问题。 您只需继续执行以下操作:

    print result.pvalue
    print result.conf_int()
    print result.rsquared
    

    【讨论】:

    • 仍在计算 R 平方
    猜你喜欢
    • 2015-05-09
    • 1970-01-01
    • 2019-09-08
    • 2021-02-28
    • 2013-05-01
    • 1970-01-01
    • 2021-09-06
    • 2021-08-09
    • 2020-05-05
    相关资源
    最近更新 更多