zval in signrank test

6 Ansichten (letzte 30 Tage)
Jie Ning
Jie Ning am 13 Okt. 2011
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!

Akzeptierte Antwort

Jie Ning
Jie Ning am 16 Okt. 2011
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 Kommentar
the cyclist
the cyclist am 16 Okt. 2011
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

the cyclist
the cyclist am 15 Okt. 2011
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 am 15 Okt. 2011
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