> ## 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.

> 2つの母集団から抽出したサンプルに対してスチューデントのt検定を適用します。

# studentTTest

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

導入バージョン: v21.1.0

2 つの母集団から得られたサンプルに対してスチューデントの t 検定を適用します。

両方のサンプルの値は `sample_data` カラムに格納されます。`sample_index` が 0 の場合、その行の値は 1 つ目の母集団のサンプルに属します。それ以外の場合は、2 つ目の母集団のサンプルに属します。
帰無仮説は、母集団の平均が等しいというものです。分散が等しい正規分布を仮定します。

**関連項目**

* [スチューデントの t 検定](https://en.wikipedia.org/wiki/Student%27s_t-test)
* [welchTTest 関数](/ja/reference/functions/aggregate-functions/welchTTest)

**構文**

```sql theme={null}
studentTTest([confidence_level])(sample_data, sample_index)
```

**パラメータ**

* `confidence_level` — 任意。信頼区間の計算に使用する信頼水準。[`Float`](/ja/reference/data-types/float)

**引数**

* `sample_data` — サンプルデータ。[`Integer`](/ja/reference/data-types/int-uint) または [`Float`](/ja/reference/data-types/float) または [`Decimal`](/ja/reference/data-types/decimal)
* `sample_index` — サンプルインデックス。[`Integer`](/ja/reference/data-types/int-uint)

**戻り値**

2 つまたは 4 つの要素を持つタプルを返します (任意の `confidence_level` が指定されている場合) 。計算された t 統計量、計算された p 値、\[計算された信頼区間の下限]、\[計算された信頼区間の上限]。[`Tuple(Float64, Float64)`](/ja/reference/data-types/tuple) または [`Tuple(Float64, Float64, Float64, Float64)`](/ja/reference/data-types/tuple)

**例**

**基本的な使い方**

```sql title=Query theme={null}
SELECT studentTTest(sample_data, sample_index) FROM student_ttest;
```

```response title=Response theme={null}
┌─studentTTest(sample_data, sample_index)───┐
│ (-0.21739130434783777,0.8385421208415731) │
└───────────────────────────────────────────┘
```

**関連項目**

* [スチューデントのt検定](https://en.wikipedia.org/wiki/Student%27s_t-test)
* [welchTTest関数](/ja/reference/functions/aggregate-functions/welchTTest)
