Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

statly

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

statly

Optimized Statistics Library

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

Statly

Statly is a statistics library which is performance-tuned for samples with repeated values. Its methods can accept populations as arrays, but it converts them to value-keyed tally objects.

Install

npm install statly

or

yarn add statly

API

tally (Array samples) ➜ Tally counts

Convert an Array to an Tally object, with a key for each unique number in the sample array, and corresponding values indicating the number of times that number appears in the sample array.

Example:

const { tally } = require('statly')
const samples = [ 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4 ]
const counts = tally(samples)
// counts ➜ { 1: 2, 2: 5, 3: 4, 4: 1 }

uTest (a: Array|Tally, b: Array|Tally) ➜ { p: Number, auc: Number }

Perform a Mann-Whitney U Test (AKA a Wilcoxon Rank Sum Test) comparing sample a and b.

  • p represents the probability that both sets of samples could have been randomly selected from the same underlying distribution.
  • auc is the area under an ROC curve, which corresponds to the portion of a × b sample pairings in which the a value is greater than the b value.

Example:

const { uTest } = require('statly')
const a = [ 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4 ]
const b = [ 3, 4, 4, 4, 5, 5, 5, 6, 6, 7 ]
const result = uTest(a, b)
// result ➜ { p: 0.0009765625, auc: 0.0375 }

FAQs

Package last updated on 11 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts