当前位置: 首页>>代码示例>>Python>>正文


Python OLS.summary2方法代码示例

本文整理汇总了Python中statsmodels.regression.linear_model.OLS.summary2方法的典型用法代码示例。如果您正苦于以下问题:Python OLS.summary2方法的具体用法?Python OLS.summary2怎么用?Python OLS.summary2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在statsmodels.regression.linear_model.OLS的用法示例。


在下文中一共展示了OLS.summary2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_OLSsummary_rsquared_label

# 需要导入模块: from statsmodels.regression.linear_model import OLS [as 别名]
# 或者: from statsmodels.regression.linear_model.OLS import summary2 [as 别名]
    def test_OLSsummary_rsquared_label(self):
        # Check that the "uncentered" label is correctly added after rsquared
        x = [1, 5, 7, 3, 5, 2, 5, 3]
        y = [6, 4, 2, 7, 4, 9, 10, 2]
        reg_with_constant = OLS(y, x, hasconst=True).fit()
        assert 'R-squared:' in str(reg_with_constant.summary2())
        assert 'R-squared:' in str(reg_with_constant.summary())

        reg_without_constant = OLS(y, x, hasconst=False).fit()
        assert 'R-squared (uncentered):' in str(reg_without_constant.summary2())
        assert 'R-squared (uncentered):' in str(reg_without_constant.summary())
开发者ID:ChadFulton,项目名称:statsmodels,代码行数:13,代码来源:test_summary2.py

示例2: test_ols_summary_rsquared_label

# 需要导入模块: from statsmodels.regression.linear_model import OLS [as 别名]
# 或者: from statsmodels.regression.linear_model.OLS import summary2 [as 别名]
def test_ols_summary_rsquared_label():
    # Check that the "uncentered" label is correctly added after rsquared
    x = [1, 5, 7, 3, 5, 2, 5, 3]
    y = [6, 4, 2, 7, 4, 9, 10, 2]
    reg_with_constant = OLS(y, add_constant(x)).fit()
    r2_str = 'R-squared:'
    with pytest.warns(UserWarning):
        assert r2_str in str(reg_with_constant.summary2())
    with pytest.warns(UserWarning):
        assert r2_str in str(reg_with_constant.summary())

    reg_without_constant = OLS(y, x, hasconst=False).fit()
    r2_str = 'R-squared (uncentered):'
    with pytest.warns(UserWarning):
        assert r2_str in str(reg_without_constant.summary2())
    with pytest.warns(UserWarning):
        assert r2_str in str(reg_without_constant.summary())
开发者ID:statsmodels,项目名称:statsmodels,代码行数:19,代码来源:test_summary2.py


注:本文中的statsmodels.regression.linear_model.OLS.summary2方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。