@elstats/linear-regression

1.3.0 • Public • Published

linear-regression Build Status

Simple Linear Regression. https://en.wikipedia.org/wiki/Simple_linear_regression

Installation

$ npm i @elstats/linear-regression

Usage

import linearRegression from '@elstats/linear-regression';

linearRegression([
    [1,   0.5],
    [2,   1.1],
    [3.1, 1.7],
    [3.9, 1.98],
    [5.2, 2.45],
    [6,   3]
]);
// { a: 0.4745265503156331, b: 0.1116728555514297, rSquared: 0.9898548897522457 }

where a and b are parameters of regression line y = a⋅x + b. Besides slope a and y-intercept b coefficient of determination is returned as rSquared.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @elstats/linear-regression

Weekly Downloads

86

Version

1.3.0

License

MIT

Unpacked Size

6.13 kB

Total Files

11

Last publish

Collaborators

  • michal.jezierski