public void WScore() { int[] signs = { -1, -1, +1, -1, +1, +1, +1, +1, +1, +1, +1, +1 }; double[] ranks = { 1, 2, 3, 4, 5.5, 5.5, 7, 8, 9, 10, 11, 12 }; double[] diffs = { 0.1, 0.2, 0.3, 0.6, 1.5, 1.5, 1.8, 2.0, 2.1, 2.3, 2.6, 12.4 }; double wm, wp, u; { double expected = 7; wm = WilcoxonDistribution.WNegative(signs, ranks); Assert.AreEqual(expected, wm); } { double expected = 71; wp = WilcoxonDistribution.WPositive(signs, ranks); Assert.AreEqual(expected, wp); } { double expected = 7; u = WilcoxonDistribution.WMinimum(signs, ranks); Assert.AreEqual(expected, u); } { double n = signs.Length; double total = wm + wp; double expected = (n * (n + 1)) / 2; Assert.AreEqual(expected, total); } }