Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange (bad) behavior on indexOfOutliers #2

Open
andrewjaykeller opened this issue Jan 27, 2016 · 2 comments
Open

Strange (bad) behavior on indexOfOutliers #2

andrewjaykeller opened this issue Jan 27, 2016 · 2 comments

Comments

@andrewjaykeller
Copy link

Testing your package pre deployment... found error:

var stats = require("stats-analysis");
var myArray = [5000,4900,1000,3000,4400,1200300,5000,5500,126500];
var indexsToRemove = stats.indexOfOutliers(myArray);
console.log(indexsToRemove);

This logs:
[5,6,8]

Now 5 and 8, totally agree, but why would 6 be removed?

@alyssaq
Copy link
Owner

alyssaq commented Jan 27, 2016

Hmm, strange. Ill take a look later today.

@alyssaq
Copy link
Owner

alyssaq commented Feb 2, 2016

Oh right!!
The default outlier method uses medianDifferencing so a number is considered an outlier if the difference is higher than the median.
You'll want to use the other outlier method MAD that doesnt care about order.
stats.indexOfOutliers(arr, stats.outlierMethod.MAD)

I just pushed a new version so you'll have to npm install again.
Thanks for reporting this! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants