Skip to main content
Module

x/simplestatistics/index.js>linearRegression

simple statistics for node & browser javascript
Go to Latest
function linearRegression
import { linearRegression } from "https://deno.land/x/simplestatistics@v7.7.5/index.js";

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.

Examples

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

Parameters

data

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