Wilcoxon SignedRank test (Calculator)
The Wilcoxon SignedRank test checks continuous or ordinal data for a significant difference between two dependent groups. The test finds the deltas of the two groups. Then, it sorts the pairs by the absolute value of the deltas.
When to use?
The test usually comes as a failsafe option to a paired ttest when the test doesn't meet the normality assumption, or contains many outliers. If the two groups have a similar distribution curve, the test will also check if the median of the deltas is the expected value. A paired ttest is slightly stronger than a Wilcoxon SignedRank Test. A Wilcoxon SignedRank Test has 95% efficiency in comparison to a paired ttest. If the population is similar to a normal distribution and reasonably symmetric, it is better to use a pair ttest. A paired ttest compares the means of the two groups, while a Wilcoxon SignedRank test compares the entire distributions.
 Not Normal, the data is not normally distributes
 Ordinal data, but not interval scaled, for example: Unhappy, Neutral, Happy
 Outliers the test is robust for outliers
Assumptions
 Dependent pairs, but independence between the pairs
 Ordinal / Continuous the compared data consist of ordinal data or Continuous data
 Shape the data is not necessarily normally distributed but should have a similar shape. If not you can compare the ranks but not the medians
Calculate W
 Calculate the difference between the pairs, for example after treatment value minus before treatment value
 Exclude pairs with zero difference and sort by the absolute rank
 Sort the data from low absolute value to high absolute value

Rank the list, the lower absolute value get rank of 1 , the second rank of 2, etc
When having ties group, identical value for several observations the rank will be the average of the ranks for the entire group
Give each rank a sign positive if the difference is positive and negative if the difference is negative.
 Accumulate the ranks
R_{i}  the absolute rank of the i rank difference.
n  number of pairs, where the difference is not zero. $$W_+=\sum_{i=1}^{n}{R_{i}}\enspace where \enspace sign\enspace is\enspace positive$$ $$W_=\sum_{i=1}^{n}{R_{i}}\enspace where \enspace sign\enspace is\enspace negative$$ $$W_++W_= \frac{n(1+n)}{2} \enspace sum \enspace of \enspace arithmetic \enspace progression$$ Since the distribution is symmetrical, usually w is the minimum between w_{+} and W_{+}. $$W=min(W_+,W_)$$ It is good for two tails test, but for one tail the test will always assume that H_{1} is the sample with bigger values is bigger than the sample with the smaller values. In this website we chose: statistics=W_{}, in this way we can calculate left tail or right tail like any other test.
 Check the critical W in the table, reject h_{0} if W < W_{critical}.
Critical Value
When n is small, the tool will use the exact value from tables, the exact critical value is accurate (for common significant levels ), while the pvalue is usually interpolated from two values in the table.
The tool uses log interpolation which is more accurate with small pvalues and less accurate with bigger pvalues. (the common significant levels are small: 0.05, 0.01).
There is no consensus about what is a small n. When Method="automatic" the tool uses the Exact method when n ≤ 40, and normal approximation when n > 40.
When Method="z approximation" the tool uses only the normal approximation
Exact value
Calculated from a statistic table.
Corrected normal approximation
To get more accurate results, the tool uses continuity correction and ties correction. ties is a group of observations with the same value) $$ z = \frac { W_  \mu_w + C_{continuity}} {\sigma_w}$$ $$ \mu= \frac {n(n+1)} {4}$$ $$ \sigma^2= \frac {n(n+1)(2n+1)} {24}  C_{ties}$$
Continuity correction
When using Continuous distribution for a discrete data. it is better to use the continuity correction.
If W > μ , C_{continuity} =  0.5
If W < μ , C_{continuity} = 0.5
Ties correction
$$C_{ties} = \sum_{i=1}^{t}{\frac{f_t^3f_t}{48}}$$
t  group number of ties
f_t  number of values in group t
example: [1,2,2,2,3,4,5,5,5,5,6,7,8,8,8,8,8,8,9,10]
$$group_1: [2,2,2], \quad f_1=3\\
group_2: [5,5,5,5], \quad f_2=4\\
group_3: [8,8,8,8,8,8], \quad f_3=6$$
Example
In the following example, we check the number of questions answered correctly by the same subject, before and after performing a training.
the significant level (α) is 0.05;
 Calculate Difference Absolute and Sign: (Difference = After Before, Absolute = Absolute(Difference), Sign = sign(Difference) )
 The sample size contains 13 pairs. Exclude D pair with zero difference
n = 13  1 = 12  Sort by Absolute value
 Simple Rank  rank by the Absolute value, the lower Absolute value get 1 rank, the second 2 etc.
 Rank  usually will be the same as Simple Rank. subjects C,E,F have identical Absolute value: 3. The rank is the average of the simple rank values
For subjects C,E,F
$$\frac{3+4+5}{3}=4$$ W = 4 + 7 = 11
W+ = 1+ 2 + 4 + 4 + 6 + 8 + 9 + 10 + 11 + 12 = 67 W = min(11 , 67) = 11
Exact value
Two tailed (H_{0}: Before = After)
 Check the the two tails statistic table, for W=11 and n=13.
 For α=0.05, critical W is 13. Since W < W_{critical} (11 < 17) we reject the H_{0}
 For α=0.02, critical W is 9
For α=0.05, critical W is 13
Since 11 is between 9 and 13, the pvalue will be between 0.02 and 0.05.  The tool will do a logarithmic extrapolation: pvalue=0.032
 Since 0.032 < 0.05 or W < W_{critical} reject H_{0}
Left tail (H_{0}: Before ≥ After)
 pvalue = pvalue(Two tailed) / 2 = 0.032 / 2 = 0.016
 Since 0.016 < 0.05, reject H_{0}
Right tail (H_{0}: Before < After)
 pvalue =1  pvalue(Two tailed) / 2 = 1  0.016 = 0.984
 Since 0.984 < 0.05, accept H_{0}
Corrected normal approximation
 There is only one tie group (t=1), that contains 3 values: f_{1}=3
$$C_{ties} = \sum_{i=1}^{1}{\frac{3^33}{48}}=0.5$$  Since W<μ , C_{continuity}=0.5 $$ \mu_w= \frac {n(n+1)}{4}=\frac {12(12+1)}{4}=39 $$ $$ \sigma^2_w= \frac {n(n+1)(2n+1)} {24}  C_{ties}= \frac {12(12+1)(2*12+1)} {24}  0.5=162.5 \quad => \sigma_w=12.7279 $$ $$ Z = \frac { W_  \mu_w + C_{continuity}} {\sigma_w}=z = \frac { 11  39 + 0.5} {12.7279}=2.16$$
 P(z≤Z) = P(z≤2.16) = 0.01539
Two tailed (H_{0}: Before = After)
 pvalue = 2 * 0.01539 = 0.03078
 Since 0.03078 < 0.05, reject H_{0}
Left tail (H_{0}: Before ≥ After)
 pvalue = P(z≤2.16) = 0.01539
 Since 0.01539 < 0.05, reject H_{0}
Right tail (H_{0}: Before < After)
 pvalue =1  P(z≤2.16) = 1  0.01539 = 0.98461
 Since 0.98461 > 0.05, accept H_{0}