> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> 返回因变量相对于其平均值的离差平方和。

# regr_syy

<h2 id="regr_syy">
  regr\_syy
</h2>

引入版本：v26.9.0

返回因变量的平方和：

$$
\Sigma{(y - \bar{y})^2}
$$

**语法**

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

**别名**：`regrSYY`

**参数**

* `y` — 因变量。[`(U)Int*`](/docs/reference/data-types/int-uint) 或 [`Float*`](/docs/reference/data-types/float)
* `x` — 自变量。[`(U)Int*`](/docs/reference/data-types/int-uint) 或 [`Float*`](/docs/reference/data-types/float)

**返回值**

返回 `y` 与其平均值之差的平方和。 [`Float64`](/docs/reference/data-types/float)

**示例**

**基本用法**

```sql title=Query theme={null}
SELECT regr_syy(y, x)
FROM VALUES('x Float64, y Float64', (1, 2), (2, 4), (3, 6), (4, 8))
```

```response title=Response theme={null}
┌─regr_syy(y, x)─┐
│             20 │
└────────────────┘
```
