Page 1 of 1

Inconsistent mean differences sign for Mann-Whitney test

Posted: Tue Apr 24, 2018 5:32 pm
by vmoreno
Hi,
The Mann-Whitney test reports reversed sign for the mean difference.
See the attached figure.

Also, I don't know how the reported statistic is calculated. It is different from W reported by wilcox.test
The p-value is the same, so I suppose it must be a transformation

Victor

Re: Inconsistent mean differences sign for Mann-Whitney test

Posted: Wed Apr 25, 2018 6:39 am
by jonathon
oh this keeps biting me.

so mann-whitney produces two U statistics, and you're supposed to use the smaller value.

but the wilcox.test in R has a bug/feature where it gives you one of the U statistics, but not necessarily the smaller one. so we have to run it both ways, see which is the smaller U value, and use that.

to run it both ways, i just swap the groups. this first bit me, because i wasn't using the right p-value with the one-sided tests. now it's bitten me because i didn't adjust the means!

anyhow, thanks for reporting, i'll commit a fix now.

cheers

jonathon

ps. when somethings clearly a bug, it's best to report it in the github issue tracker.