필터 지우기
필터 지우기

Why different p-values for ranksum and kruskalwallis on two groups

조회 수: 2 (최근 30일)
RR
RR 2018년 11월 19일
답변: Star Strider 2018년 11월 19일
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?

채택된 답변

Star Strider
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개)

Community Treasure Hunt

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

Start Hunting!

Translated by