Wilcoxon signed-rank test

While reading Wikipedia, and my teacher's notes, I found that Wilcoxon signed rank test for n>10 is given like below:

Under null hypothesis, W follows a specific distribution with no simple expression. This distribution has an expected value of 0 and a variance of $\frac{N_r(N_r + 1)(2N_r + 1)}{6}$. W can be compared to a critical value from a reference table.[1] The two-sided test consists in rejecting $H_0$, if $|W| \ge W_{critical, N_r}$. As $N_r$ increases, the sampling distribution of $W$ converges to a normal distribution. Thus, For $N_r \ge 10$, a z-score can be calculated as $z = \frac{W}{\sigma_W}, \sigma_W = \sqrt{\frac{N_r(N_r + 1)(2N_r + 1)}{6}}$. If $|z| > z_{critical}$ then reject $H_0$ (two-sided test)

On the other hand, im using 4 other books were for the same test, mean it's said to be: $μ_T = \frac{N_r(N_r + 1)}{4}$

and variance $\sigma_T=\sqrt{\frac{N_r(N_r + 1)(2N_r + 1)}{24}}$

Which is the right one?

• Please give at least one reference for the second set of formulas Aug 31 '15 at 1:36

There's more than one way to define the statistic; they'll all give the same decision, but the calculation of the statistic (and hence the mean) will be different. Either of those formulas you mention should be correct if you use the version of the test statistic that goes with them.

[Since you haven't stated what test statistic you're using when you do the test, it's impossible to tell you which of the two sets of formulas applies to your version of the test statistic.]

Immediately above the section you quote, the Wikipedia article defines the version of the test statistic it was using. It's correct for that version of the test statistic. No doubt the books you're looking at will be correct for the version of the test statistic they use ... which will be different from, but related to, the one in the Wikipedia article.

Edit: one statistic that has the same mean as you describe occurs when you define the statistic as given here[1] under "How it works":

Rank the absolute value of the differences between observations from smallest to largest [...] Add the ranks of all differences in one direction, then add the ranks of all differences in the other direction. The smaller of these two sums is the test statistic, W (sometimes symbolized Ts). Unlike most test statistics, smaller values of W are less likely under the null hypothesis.

[1] McDonald, J.H. (2014).
Handbook of Biological Statistics, 3rd ed.
Sparky House Publishing, Baltimore, Maryland.
(print version; web version at above link)