JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q53103F
  • License MIT

Library for creating regression and trend from requested data set.

Package Exports

  • regression-trend

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (regression-trend) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Status Coverage Status

Regression Trend

Library for creating regression and trend from requested data set.

Regression Trend on NPM

Supported Regression Types

  • Linear
  • Power

Quick Start

Input data looks

Data pattern must looks like { x: point, y: value}

data = [{x:1,y:10},{x:2,y:15}..{x:10,y:50}];

If you want see predictable values use null for value

data = [{x:1,y:10},{x:2,y:15}..{x:10,y:50},{x:11,y:null}];

Predictable value can be everywhere

data = [{x:1,y:10},{x:2,y:null}..{x:10,y:50},{x:11,y:null}];

or

data = [{x:1,y:null},{x:2,y:null}..{x:10,y:50},{x:11,y:150}];

Try not use zero value for x,y but if you need just do it

Example output data

{ equation: { a: -1, b: 1 },
  points: 
   [ { x: 1, y: 0 },
     { x: 2, y: 1 },
     { x: 3, y: 2 },
     { x: 4, y: 3 },
     { x: 5, y: 4 } ],
  pattern: 'y = -1 + 1 * x' }

Generate regression and trend for requested point

You can use data not in order

var regression = require('regression-trend');
var inputData = [{x:1,y:10},{x:2,y:15},{x:10,y:50}];

var output = regression.generate(inputData);

You can create predictable values for selected points

var value = regression.trend(output.equation,5);

Generate regression for another type

You can create regression for another type default type of regression is linear

List of all types is in

regression.TYPES

Setting other type than default

regression.setType(regression.TYPES.power);