tompollard / tableone

Create "Table 1" for research papers in Python
https://pypi.python.org/pypi/tableone/
MIT License
161 stars 38 forks source link

Inclusion of Mann Whitney U test for non-normal distributed numerical variables #94

Closed hello-bob closed 4 years ago

hello-bob commented 4 years ago

Hello,

I realised that the default for the non-normal distributed numerical variables is to use a Kruskal Wallis test. However from what know, Kruskal Wallis is generally used only when there are 3 or more categories to compare across. It would be good to have an option I think?

Thank you!

Best wishes, Zi Yu

tompollard commented 4 years ago

@jraffa any thoughts on this?

@hello-bob for the meantime, we have added an argument to allow custom tests to be specified (on the master branch, but will be available for pip install shortly). See: https://github.com/tompollard/tableone/issues/92 for example usage.

jraffa commented 4 years ago

@hello-bob is there a particular use case that you wanted to use Mann-Whitney over Kruskal-Wallis?

I ask because they are equivalent for many things (i.e., identical p-values). I was trying to think of a circumstance where Mann-Whitney would be required over Kruskal-Wallis for a two sample case, and I could see for a one-sided test, but was coming up blank otherwise.

hello-bob commented 4 years ago

@tompollard Thank you so much! I hope others will be able to utilise that function too.

@jraffa I see, I had the impression that the Mann-Whitney test was more appropriate than the Kruskal-Wallis for two groups. I am not a statistician, so that is what I got from flipping textbooks! Thank you for letting me know.

Thanks all for addressing my question! Have a great day ahead.

tompollard commented 4 years ago

@hello-bob I notice the issue was reopened. Does this suggest you think we need to review the choice of test or was it unintentional?

hello-bob commented 4 years ago

Right, I'm sorry. I thought it would be more appropriate if you closed the issue!

tompollard commented 4 years ago

@hello-bob got it, thanks. i'll close the issue, but please re-open if you would like to explore the option of changing any of the default tests. happy to do this if necessary :)