Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mann-Whitney U (mwu): the computation of rank-biserial correlation (RBC) is problematic #428

Open
mmpeng9 opened this issue Jul 16, 2024 · 1 comment
Assignees
Labels
invalid 🚩 This doesn't seem right

Comments

@mmpeng9
Copy link

mmpeng9 commented Jul 16, 2024

Hi there,

I found that the computation of rank-biserial correlation (RBC) is problematic. This is related to #417 and #424.

According to the cited paper, there are three ways to compute RBC. It seems you adopted the third method based on Hans Wendt (1972): r=1 – (2U)/ (n1 * n2). From the paper, U is the smaller number between U1 and U2:

Finding the test statistic U requires two steps. First, compute the number of favorable and unfavorable pairs; or what is the same thing, compute U1 and U2, as defined in Equations 1 and 2. Second, select the smaller of the two numbers; this smaller number is the test statistic U.

According to SciPy,

the Mann-Whitney U statistic corresponding with sample x; If U1 is the statistic corresponding with sample x, then the statistic corresponding with sample y is U2 = x.shape[axis] * y.shape[axis] - U1.

It seems that the returned U is not the smaller one in U1 and U2. And, it will result in a RBC value that is negative (according to the paper, this should always be positive). This is also demonstrated in my experiments.

Thanks!

@raphaelvallat raphaelvallat self-assigned this Sep 3, 2024
@raphaelvallat raphaelvallat added the invalid 🚩 This doesn't seem right label Sep 3, 2024
@raphaelvallat
Copy link
Owner

Hi @mmpeng9

Thanks for opening the issue and apologies about the late reply. Can you please share your experiments here? When doing so, can you please make sure that you are using the latest available fork of Pingouin (which includes #424) and not the current stable release (0.5.4).

Thanks
Raphael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid 🚩 This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants