Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

statistics

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

statistics

calculate mean standard deviation in one pass

  • 3.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
216
decreased by-25.52%
Maintainers
1
Weekly downloads
 
Created
Source

statistics

a reduce function that calculates mean and standard deviation in one pass

I first wrote this module a long long time ago, and i used an object oriented api. Today I needed to serialize a stats output to JSON, and then later parse it, and keep using it. Continuing to use an OO api would mean a bunch of glue code, so I rewrote it as a reduce function.

example

var stats = require('statistics')

console.log([1,2,3].reduce(stats))
=> {
  mean: 2,
  stdev: 0.8164965809277263,
  count: 3,
  sum: 6,
  sqsum: 14
}

you probably only want to have the mean and stdev, the other fields are necessary for the reduce function however.

functional is better than object oriented

statistics@2 and earlier used an object oriented api, but then I needed to serialize and parse a stats object and keep using it. That was incredibly easy with a reduce function, but would have meant a bunch of ugly glue code with OO.

LICENSE

MIT

FAQs

Package last updated on 09 Oct 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc