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

student-histogram

v2.0.0

Published

Record a sample and compute its statistical significance

Downloads

29

Readme

student-histogram

Record a sample and compute its statistical significance. Uses native-hdr-histogram and a two-tailed t-distribution table under the hood. Good for sample sizes below 200. HDR histogram is designed for "value measurements in latency and performance sensitive applications", quantizes values with a configurable precision and has a constant memory footprint.

npm Node version Test Standard

Example

const StudentHistogram = require('student-histogram')
const h = new StudentHistogram(1, 200, 3)

// Record some example values.
const sample = [100, 120, 101, 103, 99]
sample.forEach(v => h.record(v))

const log = console.log
const percent = require('fixed-number')(1, 2, 'percent')

log('arithmetic mean            : %d ±%s', h.mean(), percent(h.rme()))
log('standard deviation         :', h.stddev())
log('minimum and maximum        : %d and %d', h.min(), h.max())
log('75% of values fall below   :', h.percentile(75))
log()

log('standard error of the mean :', h.sem())
log('margin of error            :', h.moe())
log('relative margin of error   :', h.rme())
log('with higher confidence     :', h.rme(0.998))
log()

// Estimate the size (number of sampling points aka recorded values)
// that is required to achieve a relative margin of error of 0.05.
log('recommended sample size    :', h.minimumSize(0.05))
log('for 99.5% confidence       :', h.minimumSize(0.05, 0.995))
log('with 10% error tolerance   :', h.minimumSize(0.10))

if (h.size < h.minimumSize(0.05)) {
  // Maybe record some more!
}

Output:

arithmetic mean            : 104.6 ±9.27%
standard deviation         : 7.812809993849844
minimum and maximum        : 99 and 120
75% of values fall below   : 103

standard error of the mean : 3.493994848307593
margin of error            : 9.700727296841201
relative margin of error   : 0.09274117874609179
with higher confidence     : 0.23960921458776316

recommended sample size    : 18
for 99.5% confidence       : 70
with 10% error tolerance   : 5

API

StudentHistogram(min, max, figures, opts)

Documentation to follow.

Install

With npm do:

npm install student-histogram

See also

License

MIT © 2017-present Vincent Weevers. Based in part on benchmark.js and sample-sizer. See included LICENSE file for all copyright owners.