ClickHouse/docs/en/sql-reference/aggregate-functions/reference/cramersvbiascorrected.md
2023-03-17 21:21:11 +03:00

1.6 KiB

slug sidebar_position
/en/sql-reference/aggregate-functions/reference/cramersvbiascorrected 352

cramersVBiasCorrected

Cramér's V is a measure of association between two columns in a table. The result of the cramersV function ranges from 0 (corresponding to no association between the variables) to 1 and can reach 1 only when each value is completely determined by the other. The function can be heavily biased, so this version of Cramér's V uses the bias correction.

Syntax

cramersVBiasCorrected(column1, column2)

Arguments

  • column1 and column2 are the columns to be compared

Returned value

  • a value between 0 (corresponding to no association between the columns' values) to 1 (complete association).

Return type is always Float64.

Example

The following two columns being compared below have a small association with each other. Notice the result of cramersVBiasCorrected is smaller than the result of cramersV:

SELECT
    cramersV(a, b),
    cramersVBiasCorrected(a ,b)
FROM
    (
        SELECT
            number % 10 AS a,
            number % 4 AS b
        FROM
            numbers(150)
    );

Result:

┌──────cramersV(a, b)─┬─cramersVBiasCorrected(a, b)─┐
│ 0.41171788506213564 │         0.33369281784141364 │
└─────────────────────┴─────────────────────────────┘