> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> The `theilsU` function calculates Theils' U uncertainty coefficient, a value that measures the association between two columns in a table.

# theilsU

<h2 id="theilsU">
  theilsU
</h2>

Introduced in: v22.1.0

The `theilsU` function calculates the [Theil's U uncertainty coefficient](https://en.wikipedia.org/wiki/Contingency_table#Uncertainty_coefficient), a value that measures the association between two columns in a table.
Its values range from 0.0 (no association) to 1.0 (perfect agreement).

**Syntax**

```sql theme={null}
theilsU(column1, column2)
```

**Arguments**

* `column1` — First column to be compared. [`Any`](/reference/data-types/index)
* `column2` — Second column to be compared. [`Any`](/reference/data-types/index)

**Returned value**

Returns a value between 0 and 1. [`Float64`](/reference/data-types/float)

**Examples**

**Usage example**

```sql title=Query theme={null}
SELECT theilsU(a, b)
FROM (
    SELECT
        number % 10 AS a,
        number % 4 AS b
    FROM
        numbers(150)
);
```

```response title=Response theme={null}
┌────────theilsU(a, b)─┐
│  0.30195720557678846 │
└──────────────────────┘
```
