The levels of X, where k is the total number of levels.
n1, n2, ..., nk
Rj
The midrank of the jth observation. The midrank is the observation’s rank if it is not tied and its average rank if it is tied.
The levels of the blocking variable, where B is the total number of blocks.
Rbi
The midrank of the ith level of X within block b.
The function α defines scores as follows:
Let nt denote the number of observations tied at the median. Then nt is given by the following:
The statistic S is the sum of the values α(Rj) for the observations in the smaller group. If the two levels of X have the same numbers of observations, then the value of S corresponds to the last level of X in the value ordering.
Note: The Wilcoxon test adds a continuity correction. If (S - E(S)) is greater than zero, then 0.5 is subtracted from the numerator. If (S - E(S)) is less than zero, then 0.5 is added to the numerator.
Define ave to be the average score across all observations. Then the variance of S is given as follows:
The notation used in this section is defined in Notation. The following quantities are used in calculating the ChiSquare statistic:
Ti
E(Ti)
The expected value of the total score for level i under the null hypothesis of no difference in levels, given as follows:
Define ave to be the average score across all observations. Then the variance of T is given as follows:

Help created on 7/12/2018