メインコンテンツへスキップ
メインコンテンツへスキップ

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)                                                             │
└───────────────────────────────────────────────────────────────────┘