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


CreateContingencyTable

Declaration: TDataTable.CreateContingencyTable (Col1, Col2, LowRow, HighRow: longint; var ContTab: TInt2DArray): integer;
The function CreateContingencyTable creates the contingency table derived from the columns Col1 and Col2 using data between LowRow and HighRow. On return the variable parameter ContTab holds the contingency table, which is structured according to the following figure:

The size of the contingency table is automatically adjusted to include the marginal frequencies as well.

The function returns the following error codes:

 0 ... everything is OK, ContTab is valid
-1 ... one or both columns are out of range
-2 ... one or both columns are neither ordinal nor nominal variables (see Nominal and Ordinal Data for more)
-3 ... one of the columns contains more than DT_MAXNOMINALIDS different values