lobf
v1.0.3
Published
Find the line of best fit given a set of points
Maintainers
Readme
lobf
Find the line of best fit given a set of points

Example Usage
const lobf = require('lobf');
const myLineOfBestFit = lobf([
// [x, y]
[1.5, 3],
[1.5, 2],
[2, 1.5]
]);
console.log(myLineOfBestFit);
// Logs {
// 'slope' : -2,
// 'intercept' : 5.5
// }API
module.exports is a function as follows:
function (points: [x, y][])- calculate the line of best fit for the given points.points: [x, y][]- an array of arrays with element0as thexcoordinate and element1as theycoordinate.- returns -
{ slope, intercept }:slope: Number- the slope of the line, or theminy = mx + b.intercept: Number- the intercept of the line, or thebiny = mx + b.
