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

> 数値データの数列について分位点を厳密に計算します。

# quantilesExactInclusive

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

導入バージョン: v20.1.0

包括法を使用して、数値データの数列における異なるレベルの複数の [分位点](https://en.wikipedia.org/wiki/Quantile) を同時に正確に計算します。

この関数は [`quantileExactInclusive`](/ja/reference/functions/aggregate-functions/quantileExactInclusive) と同等ですが、複数の分位点レベルを1回で計算できるため、個別の分位点関数を呼び出すよりも効率的です。

この関数は、[R-7 method](https://en.wikipedia.org/wiki/Quantile#Estimating_quantiles_from_a_sample) で説明されている包括法を使用して分位点を計算します。
これは Excel の [PERCENTILE.INC](https://support.microsoft.com/en-us/office/percentile-inc-function-680f9539-45eb-410b-9a5e-c1355e5fe2ed) 関数と同等です。

正確な値を得るため、渡されたすべての値を配列にまとめ、その後で部分的にソートします。
ソートアルゴリズムの計算量は `O(N·log(N))` で、ここで `N = std::distance(first, last)` 比較です。

**構文**

```sql theme={null}
quantilesExactInclusive(level1, level2, ...)(expr)
```

**パラメータ**

* `level` — 分位点のレベル。0 から 1 まで (両端を含む) の定数の浮動小数点数。`level` の値には `[0.01, 0.99]` の範囲を使用することを推奨します。[`Float*`](/ja/reference/data-types/float)

**引数**

* `expr` — カラム値に対する式。結果は数値データ型、Date、または DateTime である必要があります。[`(U)Int*`](/ja/reference/data-types/int-uint) または [`Float*`](/ja/reference/data-types/float) または [`Decimal*`](/ja/reference/data-types/decimal) または [`Date`](/ja/reference/data-types/date) または [`DateTime`](/ja/reference/data-types/datetime)

**戻り値**

指定したレベルの分位点を、レベルの指定順と同じ順序で格納した Array。[`Array(Float64)`](/ja/reference/data-types/array)

**例**

**複数の厳密な包含分位点を計算する**

```sql title=Query theme={null}
CREATE TABLE num AS numbers(1000);
SELECT quantilesExactInclusive(0.25, 0.5, 0.75, 0.9, 0.95, 0.99, 0.999)(number) FROM num;
```

```response title=Response theme={null}
┌─quantilesExactInclusive(0.25, 0.5, 0.75, 0.9, 0.95, 0.99, 0.999)(number)─┐
│ [249.75,499.5,749.25,899.1,949.05,989.01,998.001]                        │
└──────────────────────────────────────────────────────────────────────────┘
```
