Skip to main content
Edit this page

simpleLinearRegression

シンプル(一次元)の線形回帰を実行します。

simpleLinearRegression(x, y)

パラメータ:

  • x — 説明変数の値を持つカラム。
  • y — 従属変数の値を持つカラム。

返される値:

結果の直線 y = k*x + b の定数 (k, 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) │
└───────────────────────────────────────────────────────────────────┘