1
Dealing with Difference Scores of Zero in the Wilcoxon Signed Ranks Test
The data below were simulated for an exercise on computing the Wilcoxon signed ranks test. Notice that one case has a difference score of zero. Traditionally, when that happens, the case is ignored, even though a difference score of zero is exactly what is expected under the null hypothesis of no difference between conditions.
Treated / Control / Difference / I copied the difference scores into Excel, deleted the case with a zero difference, found the absolute values, ranked the absolute values, sorted by the ranks, and then reattached the signs.Diff / ABS(Diff) / Rank ABS(Diff)
-3 / 3 / -1.5
3 / 3 / 1.5
6 / 6 / 3
-8 / 8 / -4.5
8 / 8 / 4.5
9 / 9 / 6
-13 / 13 / -7.5
13 / 13 / 7.5
14 / 14 / 9
19 / 19 / 10
25 / 25 / 11
32 / 32 / 12
33 / 33 / 13
33 / 33 / 14
169 / 182 / -13
302 / 310 / -8
138 / 113 / 25
89 / 83 / 6
126 / 126 / 0
158 / 139 / 19
153 / 140 / 13
115 / 82 / 33
92 / 78 / 14
6 / 3 / 3
32 / 0 / 32
138 / 130 / 8
29 / 20 / 9
94 / 61 / 33
171 / 174 / -3
The smaller of the positively versus negatively summed ranks is 1.5 + 4.5 + 7.5 = 13.5. This is exactly the value reported by SPSS:
RanksN / Mean Rank / Sum of Ranks
Treated–
Wait List / Negative Ranks / 11a / 8.32 / 91.50
Positive Ranks / 3b / 4.50 / 13.50
Ties / 1c
Total / 15
a. Treated < Wait List
b. Treated > Wait List
c. Treated = Wait List
SAS reported S = 39. An S of 39 translates to a T of = 14(15)/4 -39 = 13.5.
TestsforLocation:Mu0=0Test / Statistic / p Value
Student's t / t / 2.998418 / Pr > |t| / 0.0096
Sign / M / 4 / Pr >= |M| / 0.0574
Signed Rank / S / 39 / Pr >= |S| / 0.0123
Do note that the appropriate value of N here is now 14, not 15, since we dropped one case.
Both SPSS and SAS are using the traditional procedure of discarding all cases that have zero difference scores and then conducting the test on the remaining cases. If there were lots of zeros, that would be, IMHO, highly inappropriate.
Diff / ABS(Diff) / Rank ABS(Diff) / One alternative method of handing ties, proposed by Pratt (see Conover, 1973), is to use all the cases but when summing ranks drop the ranks of the cases with zero difference scores. With the data here, that would result in T having a value of 16.5 with N = 15. One cannot use tables of critical values of T to get the p value here, so a normal approximation is used. For these data, the mean under the null is n(n + 1) / 4 = 15(16) / 4 = 60, and the standard deviation is =, so z = (16.5-60) / 17.607 = 2.47, p = .014.
0 / 0 / 1
-3 / 3 / -2.5
3 / 3 / 2.5
6 / 6 / 4
-8 / 8 / -5.5
8 / 8 / 5.5
9 / 9 / 7
-13 / 13 / -8.5
13 / 13 / 8.5
14 / 14 / 10
19 / 19 / 11
25 / 25 / 12
32 / 32 / 13
33 / 33 / 14
33 / 33 / 15
A third method (see Conover, 1973) is to randomly assign signs to the ranks of cases with zero difference scores. For the data on hand, that would result in T being either 16.5 or 17.5. IMHO, since difference scores of zero should be counted as support of the null hypothesis, their ranks should be assigned to whichever group (positive or negative) that would move T closer to the mean expected under the null. For the present data, the rank of 1 would be assigned to the negative sum of ranks, making T have a value of 17.5.
Reference
Conover, W. J. (1973). On methods of handling ties in the wilcoxon signed-rank test. Journal of the American Statistical Association, 68, 985-988.
Karl L. Wuensch, March, 2018.