GithubHelp home page GithubHelp logo

timelyportfolio / regression-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tom-alexander/regression-js

0.0 3.0 0.0 1.7 MB

A javascript library containing a collection of least squares fitting methods

regression-js's Introduction

regression.js is a javascript library containing a collection of least squares fitting methods for finding a trend in a set of data. It currently contains methods for linear, exponential, logarithmic, power and polynomial trends.

Usage

Most regressions require only two parameters - the regression method (linear, exponential, logarithmic, power or polynomial) and a data source. A third parameter can be used to define the degree of a polynomial when a polynomial regression is required.

regression.js will return an object containing an equation array and a points array.

Linear regression

equation: [gradient, y-intercept] in the form y = mx + c

var data = [[0,1],[32, 67] .... [12, 79]];
var result = regression('linear', data);

Exponential regression

equation: [a, b] in the form y = ae^bx

Logarithmic regression

equation: [a, b] in the form y = a + b ln x

Power law regression

equation: [a, b] in the form y = ax^b

Polynomial regression

equation: [a0, .... , an] in the form a0x^0 ... + anx^n

var data = [[0,1],[32, 67] .... [12, 79]];
var result = regression('polynomial', data, 4);

Lastvalue

Not exactly a regression. Uses the last value to fill the blanks when forecasting.

Filling the blanks and forecasting

var data = [[0,1], [32, null] .... [12, 79]];

If you use a null value for data, regressionjs will fill it using the trend.

regression-js's People

Contributors

amaury-d avatar itangalo avatar tom-alexander avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.