【问题标题】:How to obtain ANOVA table with statsmodels?如何使用 statsmodels 获取 ANOVA 表?
【发布时间】:2020-02-18 00:50:50
【问题描述】:

对于链接中的示例,我还想获得一个类似于您在 SAS 中获得的 ANOVA 表,其中您有 Source (Model,Error,Total ) , DF , Sum of Squares, Mean Square, F值和p值都在一张表中。

【问题讨论】:

    标签: python pandas linear-regression statsmodels anova


    【解决方案1】:

    我一直在寻找它;我正在使用 statsmodels 的 f_oneway 函数来执行单向方差分析。但是,它返回的只是 f 统计量和 p 值。

    我从: https://towardsdatascience.com/1-way-anova-from-scratch-dissecting-the-anova-table-with-a-worked-example-170f4f2e58ad

    import statsmodels.api as sm
    from statsmodels.formula.api import ols
    
    lm=ols('BY~E', data=df).fit()
    table=sm.stats.anova_lm(lm)
    print(table)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-19
      • 2014-10-21
      • 1970-01-01
      • 2019-11-06
      • 1970-01-01
      • 1970-01-01
      • 2016-04-19
      • 2017-09-08
      相关资源
      最近更新 更多