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

summarystats

v0.3.6

Published

A package to calculate summary statistics

Downloads

1

Readme

summarystats

A lightweight package for summary stats in JavaScript. Please note this package is in the early stage of development. Take care when using it.

Expanded documentation can be found in the functionality wiki.

Installation

So far the package can only be installed through npm. unpkg coming soon.

To install:

npm install summarystats

Functionality

So far, the package can calculate the following stats:

  1. getMean: Takes an array and returns its mean.
  2. getTrimmedMean: Takes and array and n, where n is the number of items to remove from the beginning and end of the distribution.
  3. getMedian: Takes an array and returns its median.
  4. getMode: Takes and array and returns its mode.
  5. getVariance: Takes an array and returns its variance. isSample can be used to specify whether the data is a population or sample. By default isSample is set to true.
  6. getStandDev: Takes an array and returns its standard deviation. isSample can be used to specify whether the data is a population or sample. By default isSample is set to true.
  7. getPercentile: Takes and array and an nth percentile value and returns the nth percentile.
  8. getQuartiles: Takes an array and returns the first, middle, and third quartiles.
  9. getRange: Takes an array and returns its range.
  10. getIQR: Takes an array and returns its inter-quartile range.
  11. getCoV: Takes and array and returns its coefficient of variation.
  12. getMAD: Takes and array and returns its median absolute deviation.
  13. getZScore: Takes an array and a value and returns the z-score for the value.
  14. getCorrCoeff: Takes two arrays and calculates their correlation coefficient.
  15. getHarmonicMean: Takes an array and returns the harmonic mean.
  16. getGeometricMean: Takes an array and returns the geometric mean.
  17. getStandardError: Takes an array and returns the standard error.
  18. getKurtosis : Takes an array and returns the kurtosis.
  19. getSkewness: Takes an array and calculates the skewness.

Utilities

  1. matrixArrayIterator: Utility function to compute a statistic across the axes of an n-dimensional array.

Importing and usage

Functions can be imported individually. For example:

import { getMean } from 'summarystats'

And then called:

const array = [2, 3, 4, 5, 6];
const mean = getMean(array);

Alternatively, the stats object can be imported:

import stats from 'summarystats'

And then statistical function can be called on this object. This negates the need for multiple imports.

const array = [2, 3, 4, 5, 6];
const mean = stats.getMean(array);