npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

raptor-regression

v2.0.0

Published

Raptor regression detector

Downloads

9

Readme

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.