Does the matlab ranksum function work for larger sample sizes?

3 views (last 30 days)
I'm using the matlab ranksum function for a power analysis of 2 samples and I'm getting statistical significance (small p-values). However, the textbook I have only uses the wilcoxon ransum test for non-parametric small sample sizes (sample sizes of 10 to 12), and my sample size is 50.
I wanted to know if the ranksum is still valid for larger sample sizes, or I'm getting these small p-values because my sample size is too large. Also, does anyone know what is the upper limit for a sample size that ranksum can handle?
Thanks.

Accepted Answer

Star Strider
Star Strider on 20 Jul 2017
The Wilcoxon ranksum (and signrank) tests are generally used for small samples because they are distribution-free, that is they do not depend on how the data are distributed, only that the data have similar distributions. Large samples tend to be normally distributed, as described by the Central Limit Theorem (link), so the normal distribution would apply if the samples are sufficiently large.
You can certainly use the Wilcoxon ranksum on large sample sizes, and a sample size of 50 is certainly appropriate for it.
  1 Comment
the cyclist
the cyclist on 21 Jul 2017
One needs to be a little bit careful with the statement "Large samples tend to be normally distributed", which is not strictly true. The CLT is generally making asseration about the statistics of distributions, for example the mean.

Sign in to comment.

More Answers (2)

the cyclist
the cyclist on 20 Jul 2017
Edited: the cyclist on 20 Jul 2017
I would expect the test to be valid for large samples.
The danger as one moves from small samples to really large samples shifts from "Do I have enough data to see a meaningful effect?" to "I have so much data that I can detect really tiny differences between samples, but are these statistically significant differences actually meaningful?" It becomes more important to have a sense of what a meaningful effect size is.
For example, with a huge sample you might be able to detect a difference of 1 day between two 5-year survival curves. But even though it is statistically significant, it might not be clinically significant.
I don't believe there is a conceptual upper limit to sample size. Just a computer memory limit. :-)

Blanca Larraga
Blanca Larraga on 28 Nov 2018
I am using ranksum with two samples of 200 elements and I get a p value which does not make any sense and if I do the boxplot I can clearly see that there is no difference between the two samples even though I get h=1 and a p value really small. Is there any other function I should use for this prupose?
  2 Comments
Elisa Iovene
Elisa Iovene on 23 Mar 2021
Hello Blanca, I’m having the same problem. Have you solved the problem? It would be really useful Thanks!
the cyclist
the cyclist on 26 Mar 2021
Even thought the topic here is relevant, you will not usually get any response from a question and comment that are 3 years old. (I happened to see it quite by accident.)
I never noticed @Blanca Larraga's note here. But it is pretty easy to create a distribution that has statistically different ranksum(), but doesn't look very different to the eye (if you have enough data points). In the below code, you can see the difference, but barely. And I wasn't even trying very hard. :-)
rng default
N=200;
x1 = randn(N,1);
x2 = x1 + 0.21;
[p,h] = ranksum(x1,x2)
p = 0.0475
h = logical
1
figure
boxplot([x1 x2])
Can you post your data, and give more details? If you tag me with @, I'll try to take a look.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!