MATLAB Answers

ranksum function is purportedly the same as the Mann-Whitney U test, but the results differ. Is there a reason why?

조회 수: 8(최근 30일)
Scott MacKenzie
Scott MacKenzie 2021년 9월 22일
I've written a script to implement the Mann-Whitney U non-parametric test. As a guide, I used a data set (attached) and example calculations from a statistics text. The script seems to work fine, as it produces the exact same results as in the text. I also compared the results using a commercial stats application -- same. All good.
But, then I read this in the documentation for MATLAB's ranksum function: "This test is equivalent to a Mann-Whitney U-test." Hmm, I thought, let's see. When I used the same data set in ranksum, the results differ. Here's the output using ranksum:
M = readmatrix('test_data.txt')
M = 5×2
11 11 1 11 0 5 2 8 0 4
p = ranksum(M(:,1), M(:,2))
p = 0.0873
But, the values my script outputs, and as produced from a commercial app, differ:
z1 = -1.776, p1 = 0.0758
z2 = -1.803, p2 = 0.0714 (adjusted for ties)
Any insight on why these results differ is greatly appreciated.

답변(0개)

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by