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

@lgodard/outliers-interquartile-range

v1.0.4

Published

Suggests outliers based on IQR

Downloads

19

Readme

Outliers Interquartile Range

Suggests outliers based on Interquartile Range method

The calculated bounds are

lower_bound = q25 - k * interquartile_range
upper_bound = q75 + k * interquartile_range

Any value outside these bounds is suggested as an outlier.

see https://en.wikipedia.org/wiki/Interquartile_range#Outliers for details

Installation

npm install @lgodard/outliers-interquartile-range

Example

const outliersEngine = require('outliers-interquartile-range');

const options = {sorted: false, k: 1.5};

// array_values is 1-D array to be analyzed
const results = outliersEngine.getOutliers(array_values, options);

Documentation

|Option|type|default|description |------ | ----------- |---|---| |sorted|boolean|false|The submited data_array is already sorted, avoiding costly operation |k |number |1.5| Interquartile range multiplier defining the threshold

Results

The getOutliers method returns an object with the following entries

|Entry|description |------ | -----------| |outliers| Object upper & lower outliers - see above |stats |Object calculated values q25, q75 & iqr (interquartile range) |parameters |Object the used parameters combining submitted options and defaults

The upper & lower objects contain

|Entry|description |------ | -----------| |threshold| number The limit for the value being suggested as outlier |values | Array The suggested outlier values |indexes |Array The indexes against submitted data_array suggested as outliers


results = { 
    'outliers': {
        'upper': {
            'threshold': 64540.095,
            'values': [ 193568.04, 128104.71, 235793.39, 157432.6 ],
            'indexes': [ 11, 36, 43, 82]
        },
        'lower': {
            'threshold': -36329.865,
            'values': [],
            'indexes': []
        }
    },
    'parameters': {
        'sorted': false,
        'k': 1.5
    },
    'stats': {
        'q25': 1496.37,
        'q75': 26713.86,
        'iqr': 25217.49
    }
};

Acknowledgements

The main work (quartiles calculation) is done through the summary package. Many thanks to the author.

License

MIT