17.5.1.2 Algorithms (One-Sample Wilcoxon Signed Rank Test)

The Wilcoxon Sign Rank test is used to replace the one sample t-test, when the normality is questionable. So it requires looser conditions than the one sample t-test and has a wider use than the t-test.

a) For each x_i\,\! , fori=1,2,\ldots ,n , the signed differenced_i=x_i-\mu _0\,\! is found,where \mu _0\,\!is a given test value for the median of the sample.

b) Ignore the cases where d_i=0\,\!. Rank the rest of\left| d_i\right| , user_i as its rank. Pay attention to that any tied values of\left| d_i\right| are assigned the average of the tied ranks. For example, three? \left| d_i\right| ranked as 7 8 9 are ties, then their rank is (7+8+9) /3=8.?

c) To each rank is affixed the sign of d_i\,\! to which it corresponds. Let s_i=sign(d_i)r_i\,\!

d) The sum of the positive-signed ranks is calculated as

W_1=\sum_{s_i>0}s_i

Our null hypothesis is that the population median has a specific value \mu _0\,\!. We test the null hypothesis against the two-sided alternative hypothesis that the population does not have a median value \mu _0\,\!. The confidence interval is converted to hypothesis-test form. The test is a one-sample Wilcoxon Sign Rank test, and it is defined as:

H_0 \mu =\mu _0\,\!
H_1 \mu \neq \mu _0
Test Statistic z=\frac{(W-\frac{n_1(n_1+1)}4)-\frac 12\cdot sign(W-\frac{n_1(n_1+1)}4)}{\sqrt{\frac 14\cdot\sum_{i=1}^n S_i^2}}

Where W\,\!,s_i\,\! is said above n_1\,\!, and is the number of non-zero d_i\,\!, .

Significance Level \alpha \,\!: The most commonly used value for \alpha \,\! is 0.05.
Critical Region: Reject the null hypothesis that the median is a specified value, \mu _0\,\!, if

\left| z\right| >Z_{\alpha /2},where Z~N(0,1)

Because for large sample, for example the size of the population is more than 50, sized the distribution of is approximately standard normal.

For more details of the algorithm, please refer to nag_wilcoxon_test (g08agc)