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

> 모집단의 공분산을 계산합니다

# covarPop

<h2 id="covarPop">
  covarPop
</h2>

도입 버전: v1.1.0

모집단 공분산을 계산합니다:

$$
\frac{\Sigma{(x - \bar{x})(y - \bar{y})}}{n}
$$

<br />

<Note>
  이 함수는 수치적으로 불안정한 알고리즘을 사용합니다. 계산에서 [수치 안정성](https://en.wikipedia.org/wiki/Numerical_stability)이 필요한 경우 [`covarPopStable`](/reference/functions/aggregate-functions/covarPopStable) 함수를 사용하십시오. 속도는 느리지만 연산 오류가 더 적습니다.
</Note>

**구문**

```sql theme={null}
covarPop(x, y)
```

**별칭**: `COVAR_POP`

**인수**

* `x` — 첫 번째 변수. [`(U)Int*`](/reference/data-types/int-uint) 또는 [`Float*`](/reference/data-types/float) 또는 [`Decimal`](/reference/data-types/decimal)
* `y` — 두 번째 변수. [`(U)Int*`](/reference/data-types/int-uint) 또는 [`Float*`](/reference/data-types/float) 또는 [`Decimal`](/reference/data-types/decimal)

**반환 값**

`x`와 `y` 사이의 모집단 공분산을 반환합니다. [`Float64`](/reference/data-types/float)

**예시**

**기본 모집단 공분산 계산**

```sql title=Query theme={null}
DROP TABLE IF EXISTS series;
CREATE TABLE series(i UInt32, x_value Float64, y_value Float64) ENGINE = Memory;
INSERT INTO series(i, x_value, y_value) VALUES (1, 5.6, -4.4),(2, -9.6, 3),(3, -1.3, -4),(4, 5.3, 9.7),(5, 4.4, 0.037),(6, -8.6, -7.8),(7, 5.1, 9.3),(8, 7.9, -3.6),(9, -8.2, 0.62),(10, -3, 7.3);

SELECT covarPop(x_value, y_value)
FROM series
```

```response title=Response theme={null}
┌─covarPop(x_value, y_value)─┐
│                   6.485648 │
└────────────────────────────┘
```
