Example 1: Wilcoxon Rank Sum Test

The following example is taken from Conover (1980, p. 224). It involves the mixing time of two mixing machines using a total of 10 batches of a certain kind of batter, five batches for each machine. The null hypothesis is not rejected at the 5-percent level of significance.

using System;
using Imsl;
using Imsl.Stat;

public class WilcoxonRankSumEx1
{
	public static void  Main(String[] args)
	{
		double[] x = new double[]{7.3, 6.9, 7.2, 7.8, 7.2};
		double[] y = new double[]{7.4, 6.8, 6.9, 6.7, 7.1};
		
		WilcoxonRankSum wilcoxon = new WilcoxonRankSum(x, y);
		Console.Out.WriteLine
			("p-value = " + wilcoxon.Compute().ToString("0.0000"));
	}
}

Output

p-value = 0.1412
Imsl.Stat.WilcoxonRankSum: "x.length" = 5 and "y.length" = 5.  
Both sample sizes, "x.length" and "y.length", are less than 25.  
Significance levels should be obtained from tabled values. 
Imsl.Stat.WilcoxonRankSum: At least one tie is detected between the samples.

Link to C# source.