Coder Social home page Coder Social logo

mfasanya / basic-stats Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cpetersen/basic-stats

0.0 1.0 0.0 12 KB

Basic statistical functions for Ruby collections, such as mean, standard_deviation, z, and outlier detection

License: MIT License

Ruby 100.00%

basic-stats's Introduction

Basic::Stats

Build Status Code Climate Gem Version

Basic statistical functions for Ruby collections, such as mean, standard_deviation, z, and outlier detection

Installation

Add this line to your application's Gemfile:

gem 'basic-stats'

And then execute:

$ bundle

Or install it yourself as:

$ gem install basic-stats

If you aren't using rails, you may have to require the basic/stats file.

require 'basic/stats'

Usage

To use basic stat's methods, include the module in your array

  array = [1,2,3,4,5,6,7,8,9,10]
  array.extend Basic::Stats
  array.mean
  array.standard_deviation
  array.critical_z
  array.z(5)

Once you've included the module, you can also use outlier detection

  array = [1,2,3,4,5,6,7,8,9,30]
  array.extend Basic::Stats
  array.select_outliers
  array.reject_outliers
  array.reject_outliers!  

Notes on outlier detection

basic-stats uses the Grubb's test for outlier detection. Specically it assumes an alpha of 5%, meaning you will mistakenly identify an outlier in 5% of your samples. More information here.

The Grubb's test does not work well for detecting multiple outliers.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Make your changes
  4. Make sure the specs run (bundle exec rake spec)
  5. Commit your changes (git commit -am 'Add some feature')
  6. Push to the branch (git push origin my-new-feature)
  7. Create new Pull Request

basic-stats's People

Contributors

cpetersen avatar mfasanya avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.