The SPEARMAN_CORR stored procedure calculates the Spearman rank correlation between two
ordinal input columns to evaluate the dependency between these columns. The result takes a value
between -1 (inversely correlated) and 1 (correlated). Value 0 means that the two columns are
independent.
Syntax
IDAX.SPEARMAN_CORR(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 ordinal columns of the input table that are separated by a semicolon (;).
- Optionally, you can specify a third numeric column for weights that is followed by
:objweight.
- If both columns are of type DOUBLE or INT, and date or time, the order is guaranteed. If the
columns are of type character, it is assumed that the order of their values is lexicographic.
- 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 Spearman rank correlation is written.
- The output table contains the following columns:
- If the by parameter is specified, an extra BY column is added to indicate
for which group the Spearman rank correlation is calculated.
- Only those records for which both columns are not null are considered.
- Data type: VARCHAR(ANY)
Returned information
DOUBLE the Spearman rank correlation or the number of rows in the output table.
Example
CALL IDAX.SPEARMAN_CORR('intable=CENSUSINCOME,incolumn=wage_per_hour;education');
CALL IDAX.SPEARMAN_CORR('intable=CENSUSINCOME,incolumn=wage_per_hour;education, by=marital_status, outtable=SPEARMAN_CORR_RESULT');