Why different p-values for ranksum and kruskalwallis on two groups
4 次查看(过去 30 天)
显示 更早的评论
Why do I get different p-values when I’m using “Wilcoxon rank sum test” or “Kruskal-Wallis test” on two groups. Which test shoud I prefer?
[p_kruskal,t,stats] = kruskalwallis(X, gender);
[p_wilcoxon,h,stats] = ranksum(X (gender==1), X (gender==2));
I’d like to compare the distributions of this two groups using boxplot with the option of ‘notch’ on. Why even if the notches in the box plot overlap Wilcoxon suggest me that the medians of the two groups differ?
0 个评论
采纳的回答
Star Strider
2018-11-19
They are different tests, with different hypotheses. The ranksum test compares medians between two groups, assuming both share the same continuous distribution. The kruskalwallis test is to determine if the data from the groups are from the same distribution.
Use the test that addresses the problem you want to solve. If you want to determine if the medians differ, use ranksum. If you want to know if they are from the same distribution, use kruskallwallis.
‘Why even if the notches in the box plot overlap Wilcoxon suggest me that the medians of the two groups differ?’
That could be due to the sample sizes. Small absolute differences can become statistically significant if the sample sizes are large enough.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Hypothesis Tests 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!