3

I am trying to do Kruskal Wallis test in python that not only gives me the H statistics and the p value, but also the effect size.

I have tried scipy's stats.kruskal() function, but only the H and p were returned. with a pandas dataframe, so I converted the two columns of the dataframe (in the future I may need more than two) into arrays and ran scipy.stats.kruskal(L_arr,E_arr)

I first converted the two columns of interest from a pandas dataframe to two arrays L_arr and E_arr. Then I ran:

import scipy.stats as stats
stats.kruskal(L_arr, E_arr)

The result I got: KruskalResult(statistic=1.2752179327521276, pvalue=0.2587900768563777) I wish there is some way for me to get the effect size as well?

  • 1
    From the [documentation](https://docs.scipy.org/doc/scipy-0.19.1/reference/generated/scipy.stats.kruskal.html), I don't see the mention of effect size. So you might be out of luck with the library and might have to calculate that manually. – razdi Aug 13 '19 at 23:48
  • I thought so; I want to see if there are some other libraries (not scipy) that may include effect size. – VeritatemAmo Aug 14 '19 at 14:59
  • After a year, I have finally found a good python package that returns a effect size, but only for the Mann-Whitney test (so one can do non-parametric test between two groups). It is the [pingouin package's mwu function][1], which has the option of returning a common language effect size. [1]: https://pingouin-stats.org/generated/pingouin.mwu.html – VeritatemAmo May 18 '21 at 01:57

0 Answers0