# Why is Matlab signrank function returns the same signed rank statistic values when flipping the signs of the data points?

7 views (last 30 days)
Tim on 18 Apr 2013
Answered: Armando Angulo on 23 Nov 2017
Why is Matlab signrank function returns the same signed rank statistic values when flipping the signs of the data points?
I have a sequence of data points stored in vector x. I use signrank(x) to do sign rank test.
Matlab says
When you use the test for one sample, then W is the sum of the ranks of positive differences between the observations and the hypothesized median value M0 (which is 0 when you use signrank(x) and m when you use signrank(x,m)).
So I think the result signrank(x) and signrank(-x) should be different. But I have experienced some examples, and I get the same sign rank statistic value for x and -x. How is the signed rank statistic defined in Matlab signrank function?
Thanks!

Armando Angulo on 23 Nov 2017
I don't Know how matlab computes signrank, but the result it should be the same for x and -x because probability is compute with the smallest values of the independent sum of negative and positive ranks. So, in case x: negative sum = 8 positive sum = 16 you take 8 as W stat for compute p value
In contrast, in case -x: negative sum = 16 positive sum = 8 you take 8 as W stat for compute p value