ClickHouse/docs/ru/sql-reference/aggregate-functions/reference/simplelinearregression.md
BayoNet c1b71ab06e
DOCS-733: Fixed broken links in Russian version (#13106)
* CLICKHOUSEDOCS-733: Fixed some broken links. Updated introduction and TOC in aggregate functions.

* CLICKHOUSEDOCS-733: Fixed files endings.

* CLICKHOUSEDOCS-733: Returned the list of functions back to reference index.

Co-authored-by: Sergei Shtykov <bayonet@yandex-team.ru>
Co-authored-by: emironyuk <em@don.ru>
2020-07-30 15:49:19 +03:00

45 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
toc_priority: 220
---
# simpleLinearRegression {#simplelinearregression}
Выполняет простую (одномерную) линейную регрессию.
``` sql
simpleLinearRegression(x, y)
```
Параметры:
- `x` — столбец со значениями зависимой переменной.
- `y` — столбец со значениями наблюдаемой переменной.
Возвращаемые значения:
Константы `(a, b)` результирующей прямой `y = a*x + b`.
**Примеры**
``` sql
SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])
```
``` text
┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐
│ (1,0) │
└───────────────────────────────────────────────────────────────────┘
```
``` sql
SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])
```
``` text
┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐
│ (1,3) │
└───────────────────────────────────────────────────────────────────┘
```
[Оригинальная статья](https://clickhouse.tech/docs/en/sql-reference/aggregate-functions/reference/simplelinearregression/) <!--hide-->