linearRegressionLine
linearRegressionLine(
mb):Function
Defined in: src/linear_regression_line.js:18
Given the output of linearRegression: an object
with m and b values indicating slope and intercept,
respectively, generate a line function that translates
x values into y values.
Parameters
Section titled “Parameters”any
object with m and b members, representing
slope and intersect of desired line
Returns
Section titled “Returns”Function
method that computes y-value at any given x-value on the line.
Example
Section titled “Example”var l = linearRegressionLine(linearRegression([[0, 0], [1, 1]]));l(0) // = 0l(2) // = 2linearRegressionLine({ b: 0, m: 1 })(1); // => 1linearRegressionLine({ b: 1, m: 1 })(1); // => 2