Skip to main content
Module

x/simplestatistics/index.js>linearRegressionLine

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

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.

Examples

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

Parameters

mb

object with m and b members, representing slope and intersect of desired line