ClickHouse/docs/ru/sql-reference/aggregate-functions/reference/simplelinearregression.md
Anna 77cdf8c840
DOCSUP-1916 split reference.md into separate files (#12963)
* Add files with russian desc.

* Fixed links.

* Fixed links.

* Fixed link

* Fixed links.

Co-authored-by: Anna Devyatova <annadevyatova@yandex-team.ru>
2020-07-29 09:49:57 +03:00

1.5 KiB
Raw Blame History

toc_priority
220

simpleLinearRegression

Выполняет простую (одномерную) линейную регрессию.

simpleLinearRegression(x, y)

Параметры:

  • x — столбец со значениями зависимой переменной.
  • y — столбец со значениями наблюдаемой переменной.

Возвращаемые значения:

Константы (a, b) результирующей прямой y = a*x + b.

Примеры

SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])
┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [0, 1, 2, 3])─┐
│ (1,0)                                                             │
└───────────────────────────────────────────────────────────────────┘
SELECT arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])
┌─arrayReduce('simpleLinearRegression', [0, 1, 2, 3], [3, 4, 5, 6])─┐
│ (1,3)                                                             │
└───────────────────────────────────────────────────────────────────┘