DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....


Declaration: Prob2x2Contingency (FreqTab: TInt2DArray; (var Prob: double): integer;
The function Prob2x2Contingency calculates the probability Prob that the given 2x2 contingency table FreqTab occurs by chance (under the condition that the margin sums are contant).

The function returns the following error codes:

 0 ... everything is OK
-1 ... frequency table is not a 2x2 table
-2 ... frequency table too large (N must be less than 1001)
-3 ... frequency table must not contain negative numbers