Git Product home page Git Product logo

regression's Introduction

raptor-regression

Search for linear regressions in a dataset using sliding T-tests.

Install

npm install --save raptor-regression

Quick start

var regression = require('raptor-regression');

var offender = { value: 202, offender: true }; 
var data = [
  { value: 101 },
  ...
  offender,
  ...
  { value: 200 }
];

var regressions = regression(data);
//=>
[{
  regressor: {
    source: { ... },
    backAnalysis: { ... },
    foreAnalysis: { ... },
    tValue: 468.0...
  },
  previous: { ... },
  next: { ... }
}]

assert( regressions[0].regressor.source === offender );

API

@type Function
@param Array<{ value: Number }>
@returns Array<{ regressor: Object, previous: Object, next: Object }>

The API for this module is a single function which accepts a single array as input. This array should contain objects with a value property. For example:

var param = [
  { value: 100 }
]

The API will return a new array containing regression offenders along with their adjacent array members, and all relevant regression metadata. The source object is accessible in each regression entry in the source property.

Evaluating the response

Using the following example response as a guide:

[ { regressor:
   { source: { value: 202, offender: true },
     backAnalysis: { length: 12, average: 101.5, variance: 0.2727272727272727 },
     foreAnalysis: { length: 12, average: 201.5, variance: 0.2727272727272727 },
     tValue: 468.01974568701814 },
  previous:
   { source: { value: 101, offender: false },
     backAnalysis: { length: 12, average: 101.5, variance: 0.2727272727272727 },
     foreAnalysis:
      { length: 12,
        average: 193.16666666666666,
        variance: 842.6969696969695 },
     tValue: 9.773584847914274 },
  next:
   { source: { value: 201 },
     backAnalysis:
      { length: 12,
        average: 109.83333333333333,
        variance: 842.6969696969696 },
     foreAnalysis: { length: 12, average: 201.5, variance: 0.2727272727272727 },
     tValue: 9.773584847914275 } } ]
  • The response is always an array of regressions. If no regressions are detected, the array will be empty.
  • Every regression has three properties: regressor, previous, and next.
    • The regressor property contains the analysis information for the array entry which introduced a detectable change point.
    • The previous property contains the analysis information for the array entry prior to the regressor.
    • The next property contains the analysis information for the array entry after the regressor.
  • Each of the regression sub-objects contains the following properties: source, backAnalysis, foreAnalysis, and tValue.
    • The source property is a reference to the original object for which an analysis was performed on. This object is not mutated and any extraneous properties on the object have no effect.
    • The backAnalysis contains an object which represents the statistical information for the window leading up to the source.
    • The foreAnalysis contains an object which represents the statistical information for the window appearing after the source.
    • The tValue is the normalized T-test score for the backward and forward windows. This number is the determinant for a detectable change point.

regression's People

Contributors

eliperelman 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.