Example 1: Contingency Table

The following example is taken from Kendall and Stuart (1979) and involves the distance vision in the right and left eyes.

using System;
using Imsl.Stat;

public class ContingencyTableEx1
{
	public static void  Main(String[] args)
	{
		double[,] table = {{821, 112, 85, 35}, 
							   {116, 494, 145, 27},
							   {72, 151, 583, 87},
							   {43, 34, 106, 331}};
		ContingencyTable ct = new ContingencyTable(table);
		Console.Out.WriteLine("P-value = " + ct.P);
	}
}

Output

P-value = 0

Link to C# source.