Wilcoxon Algorithm

Performed on a set of numbers and labels of size N. There must be two specific labels. Label 1 must be 1 and label 2 must be 2. There can also be any other labels that will be ignored.

Wilcoxon statistic

  1. Sort the combined values in ascending order and assign numerical ranks starting with 1.
    • For a tie, assign all tied values the average rank. For example: tied 2nd and 3rd values would recieve a rank of 2.5 each; tied 5th, 6th, and 7th values would receive a rank of 6 each.
  2. Sum the ranks for each group.
    • n1 = size of the smaller group
    • n2 = size of the larger group
    • sum1 = rank sum of the smaller group
    • sum2 = rank sum of the larger group
    • n = n1 + n2
  3. The statistic is the sum of the smaller group or the smaller sum if the groups are of equal size.
    • If n1 < n2, sum1
    • If n1 = n2, least of sum1 and sum2

Wilcoxon probability

  1. Variance (Var): $\frac{n1n2}{12(n^2-n)}(n^3-n-\sum{t_i^3-t_i})$ where $t_i$ = how many values are tied in each tie
  2. z:  \begin{displaymath} \frac{|W-n1\frac{n+1}{2}|-0.5}{\sqrt{Var}} \end{displaymath}
    • If z < 0, z = 0
  3. P-value: $2*(1-probt(z,n-1))$

-- WillGray - 22 Jul 2004
Topic revision: r4 - 04 Jan 2010, JoanZhang

This site is powered by FoswikiCopyright © 2013-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback