IDAX.CHISQ_TEST - Pearson's chi-square test of independence

The CHISQ_TEST stored procedure calculates the chi-square value between the two input columns and returns the probability that the two columns are independent.

Syntax

IDAX.CHISQ_TEST(in parameter_string varchar(32672))

Parameter descriptions

parameter_string
Mandatory one-string parameter that contains pairs of <parameter>=<value> entries that are separated by a comma.
Data type: VARCHAR(32672)
The following list shows the parameter values:
intable
Mandatory.
The name of the input table.
Data type: VARCHAR(256)
incolumn
Mandatory.
The two columns of the input table that are separated by a semi-colon (;).
Data type: VARCHAR(ANY)
by
Optional.
The column of the input table that splits the data into groups for which the stored procedure is to be done.
Default: none
Data type: VARCHAR(128)
outtable
Optional.
The name of the output table to which the chi-square values are written.
The output table contains the following columns:
  • over_<by>
  • chi2statistic
  • df
  • percentage
The chi-square value between the two input columns is given for each group of the <by> column.
If the by parameter is not specified, the column is named over_no_group and contains a '-' value.
Data type: VARCHAR(256)

Returned information

What is returned depends on whether the outtable parameter is specified:
  • If it is, the number of rows in the output table is returned.
  • If it is not, the content of the output table as a result set is returned.

In addition to the chi-square statistics, this function returns the degree of freedom of the input variables and a percentage between 0 and 1. If the percentage is in the range:

  • 0 - 0.05, there is a very high probability that the input columns are mutually independent.
  • 0.05 - 0.95, the input columns are treated as mutually independent although this is uncertain.
  • 0.95 - 1, there is a very high probability that the input columns are mutually dependent.

Example

CALL IDAX.CHISQ_TEST('intable=CENSUSINCOME,incolumn=education;gender');
CALL IDAX.CHISQ_TEST('intable=CENSUSINCOME,incolumn=education;gender, by=marital_status, outtable=CHISQ_TEST_RESULT');