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

> N 個の変数に対する相関行列を計算します。

# corrMatrix

<div id="corrMatrix">
  ## corrMatrix
</div>

導入バージョン: v23.2.0

N 個の変数の相関行列を計算します。

**構文**

```sql theme={null}
corrMatrix(x1[, x2, ...])
```

**引数**

* `x1[, x2, ...]` — 相関行列を計算する対象の 1 つ以上のパラメータ。[`(U)Int8/16/32/64`](/ja/reference/data-types/int-uint) または [`Float*`](/ja/reference/data-types/float)

**戻り値**

相関行列を返します。[`Array(Array(Float64))`](/ja/reference/data-types/array)

**例**

**基本的な相関行列の計算**

```sql title=Query theme={null}
DROP TABLE IF EXISTS test;
CREATE TABLE test
(
    a UInt32,
    b Float64,
    c Float64,
    d Float64
)
ENGINE = Memory;
INSERT INTO test(a, b, c, d) VALUES (1, 5.6, -4.4, 2.6), (2, -9.6, 3, 3.3), (3, -1.3, -4, 1.2), (4, 5.3, 9.7, 2.3), (5, 4.4, 0.037, 1.222), (6, -8.6, -7.8, 2.1233), (7, 5.1, 9.3, 8.1222), (8, 7.9, -3.6, 9.837), (9, -8.2, 0.62, 8.43555), (10, -3, 7.3, 6.762);

SELECT arrayMap(x -> round(x, 3), arrayJoin(corrMatrix(a, b, c, d))) AS corrMatrix
FROM test
```

```response title=Response theme={null}
┌─corrMatrix─────────────┐
│ [1,-0.096,0.243,0.746] │
│ [-0.096,1,0.173,0.106] │
│ [0.243,0.173,1,0.258]  │
│ [0.746,0.106,0.258,1]  │
└────────────────────────┘
```
