simpleLinearRegression

Performs simple (unidimensional) linear regression.

  1. simpleLinearRegression(x, y)

Parameters:

  • x — Column with dependent variable values.
  • y — Column with explanatory variable values.

Returned values:

Constants (a, b) of the resulting line y = a*x + b.

Examples

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