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

> 두 모집단에서 추출한 표본에 평균 z-검정을 적용합니다.

# meanZTest

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

도입 버전: v22.2.0

두 모집단에서 추출한 표본에 평균 z-검정을 적용합니다.

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

**구문**

```sql theme={null}
meanZTest(population_variance_x, population_variance_y, confidence_level)(sample_data, sample_index)
```

**매개변수**

* `population_variance_x` — 모집단 x의 분산입니다. [`Float*`](/ko/reference/data-types/float)
* `population_variance_y` — 모집단 y의 분산입니다. [`Float*`](/ko/reference/data-types/float)
* `confidence_level` — 신뢰 구간을 계산하기 위한 신뢰 수준입니다. [`Float*`](/ko/reference/data-types/float)

**인수**

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

**반환 값**

계산된 z-통계량, 계산된 p값, 계산된 신뢰 구간 하한, 계산된 신뢰 구간 상한의 4개 요소로 이루어진 Tuple을 반환합니다. [`Tuple(Float64, Float64, Float64, Float64)`](/ko/reference/data-types/tuple)

**예시**

**평균 Z-검정 예시**

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

SELECT meanZTest(0.7, 0.45, 0.95)(sample_data, sample_index) FROM mean_ztest;
```

```response title=Response theme={null}
┌─meanZTest(0.7, 0.45, 0.95)(sample_data, sample_index)───────────────────────────────┐
│ (3.2841296025548123, 0.0010229786769086013, 0.8198428246768334, 3.2468238419898365) │
└─────────────────────────────────────────────────────────────────────────────────────┘
```
