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

> 두 모집단의 표본에 Welch의 t-검정을 적용합니다.

# welchTTest

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

버전 v21.1.0에서 도입됨

두 모집단의 표본에 [Welch의 t-검정](https://en.wikipedia.org/wiki/Welch%27s_t-test)을 적용합니다.

두 표본의 값은 모두 `sample_data` 컬럼에 있습니다.
`sample_index`가 0이면 해당 행의 값은 첫 번째 모집단의 표본에 속합니다.
그렇지 않으면 두 번째 모집단의 표본에 속합니다.
귀무가설은 두 모집단의 평균이 같다는 것입니다.
정규분포를 가정합니다.
모집단의 분산은 서로 다를 수 있습니다.

**구문**

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

**매개변수**

* `confidence_level` — 선택 사항입니다. 신뢰 구간을 계산하기 위한 신뢰 수준입니다. [`Float`](/ko/reference/data-types/float)

**인수**

* `sample_data` — 표본 데이터입니다. [`Int*`](/ko/reference/data-types/int-uint) 또는 [`UInt*`](/ko/reference/data-types/int-uint) 또는 [`Float*`](/ko/reference/data-types/float) 또는 [`Decimal*`](/ko/reference/data-types/decimal)
* `sample_index` — 표본 인덱스입니다. [`Int*`](/ko/reference/data-types/int-uint) 또는 [`UInt*`](/ko/reference/data-types/int-uint)

**반환 값**

요소가 2개 또는 4개인 Tuple을 반환합니다(선택 사항인 `confidence_level`이 지정된 경우). 반환되는 값은 계산된 t-통계량, 계산된 p-값, 그리고 선택적으로 계산된 신뢰 구간의 하한과 상한입니다. [`Tuple(Float64, Float64)`](/ko/reference/data-types/tuple) 또는 [`Tuple(Float64, Float64, Float64, Float64)`](/ko/reference/data-types/tuple)

**예시**

**Welch의 기본 t-검정**

```sql title=Query theme={null}
CREATE TABLE welch_ttest (sample_data Float64, sample_index UInt8) ENGINE = Memory;
INSERT INTO welch_ttest VALUES (20.3, 0), (22.1, 0), (21.9, 0), (18.9, 1), (20.3, 1), (19, 1);

SELECT welchTTest(sample_data, sample_index) FROM welch_ttest;
```

```response title=Response theme={null}
┌─welchTTest(sample_data, sample_index)──────┐
│ (2.7988719532211235, 0.051807360348581945) │
└────────────────────────────────────────────┘
```

**신뢰 수준 포함**

```sql title=Query theme={null}
SELECT welchTTest(0.95)(sample_data, sample_index) FROM welch_ttest;
```

```response title=Response theme={null}
┌─welchTTest(0.95)(sample_data, sample_index)─────────────────────────────────────────┐
│ (2.7988719532211235, 0.05180736034858519, -0.026294346671631885, 4.092961013338302) │
└─────────────────────────────────────────────────────────────────────────────────────┘
```

**관련 항목**

* [Welch의 t-검정](https://en.wikipedia.org/wiki/Welch%27s_t-test)
* [studentTTest 함수](/ko/reference/functions/aggregate-functions/studentTTest)
