linearRegression
linearRegression(
data):any
Defined in: src/linear_regression.js:13
Simple linear regression is a simple way to find a fitted line between a set of coordinates. This algorithm finds the slope and y-intercept of a regression line using the least sum of squares.
Parameters
Section titled “Parameters”number[][]
an array of two-element of arrays,
like [[0, 1], [2, 3]]
Returns
Section titled “Returns”any
object containing slope and intersect of regression line
Example
Section titled “Example”linearRegression([[0, 0], [1, 1]]); // => { m: 1, b: 0 }