Skip to content

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.

number[][]

an array of two-element of arrays, like [[0, 1], [2, 3]]

any

object containing slope and intersect of regression line

linearRegression([[0, 0], [1, 1]]); // => { m: 1, b: 0 }