zval in signrank test

조회 수: 15 (최근 30일)
Jie Ning
Jie Ning 2011년 10월 13일
Hi,
I am using signrank function and got confused on the zval in "stats" output. Isn't it the value of the z-statistic in the Wilcoxon test? But if we do
[p,h,stats]=signrank(1:50)
Shouldn't zval be positive? But what you'll get is -6.15. Moreover,
[p,h,stats]=signrank(1:50,3:52)
[p,h,stats]=signrank(3:52,1:50)
gives the same zval. Does anyone know how exactly is the zval computed and if its sign has a meaning?
Thank you!

채택된 답변

Jie Ning
Jie Ning 2011년 10월 16일
Thank you for the responses. I do think there is a bug in computing the zval in signrank. It always gives negative values. Walter, you are right about the sign of z-values. But in matlab, it gives the same zvals even when I compute
[p,h,stats]=signrank(1:50,3:52)
[p,h,stats]=signrank(3:52,1:50),
which should definitely result in positive and negative z-val... But I checked several examples and found out that the absolute values of Matlab's zvals are correct. So only the sign is off.
  댓글 수: 1
the cyclist
the cyclist 2011년 10월 16일
I think you are mistaken that this is a bug. It is true that the order of the input arguments does not affect the sign of the z-statistic. But, as I outlined in my own answer, that is to be expected.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

the cyclist
the cyclist 2011년 10월 15일
You can see the exact calculation of zval by typing
>> edit signrank
The comments at the top of that file list references for the calculation.
I don't have experience using the test, but searching around the web a bit, I've found a few places that quoted negative values for the z-statistic, so I think that may be conventional. Here is one such site: http://www.unistat.com/guide/nonparametric-tests/paired-samples
I got curious, and did a bit more digging. If you look at the "Test procedure" section of the Wikipedia page on this test:
you'll see that Step 6 in the procedure is to take the smaller of the two rank sums: S = min(W+,W-). I'm guessing that this use of the minimum guarantees that the z-statistic will be negative, as it will be less than the expected value for the null hypothesis (as Walter alludes to).
You can see this test procedure reflected in the MATLAB code.

Walter Roberson
Walter Roberson 2011년 10월 15일
The z value would be negative if the statistic is below the Expected Value.
This is the same, but approached a different way, as is stated outright at http://en.wikipedia.org/wiki/Standard_score#Calculation_from_raw_score, which says,
The quantity z represents the distance between the raw score and the population mean in units of the standard deviation. z is negative when the raw score is below the mean, positive when above.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by