What statistics module for python supports one way ANOVA with post hoc tests (Tukey, Scheffe or other)?

前端 未结 2 566
遇见更好的自我
遇见更好的自我 2020-12-12 17:37

I have tried looking through multiple statistics modules for Python but can\'t seem to find any that support one-way ANOVA post hoc tests.

相关标签:
2条回答
  • 2020-12-12 18:03

    I think that the library Pyvttbl returns a ANOVA table including post-hoc tests (i.e., TukeyHSD). In fact, what is neat with Pyvttbl is that you can carry out ANOVA for repeated measures also.

    See the doc for Anova1way here

    0 讨论(0)
  • 2020-12-12 18:07

    one way ANOVA can be used like

    from scipy import stats
    f_value, p_value = stats.f_oneway(data1, data2, data3, data4, ...)
    

    This is one way ANOVA and it returns F value and P value.
    There is significant difference If the P value is below your setting.


    The Tukey-kramer HSD test can be used like

    from statsmodels.stats.multicomp import pairwise_tukeyhsd
    print pairwise_tukeyhsd(Data, Group)
    

    This is multicomparison. The output is like

    Multiple Comparison of Means - Tukey HSD,FWER=0.05
    ================================================
    group1 group2 meandiff   lower    upper   reject
    ------------------------------------------------
      0      1    -35.2153 -114.8741 44.4434  False 
      0      2     46.697   -40.4993 133.8932 False 
      0      3    -7.5709    -87.49  72.3482  False 
      1      2    81.9123    5.0289  158.7956  True 
      1      3    27.6444   -40.8751  96.164  False 
      2      3    -54.2679 -131.4209 22.8852  False 
    ------------------------------------------------
    

    Please refer to this site how to set the arguments.
    The tukeyhsd of statsmodels doesn't return P value.
    So, if you want to know P value, calculate from these outputted value or use R.

    0 讨论(0)
提交回复
热议问题