{"id":13718974,"url":"https://github.com/jtescher/descriptive-statistics","last_synced_at":"2025-05-07T10:34:12.852Z","repository":{"id":4857715,"uuid":"6012337","full_name":"jtescher/descriptive-statistics","owner":"jtescher","description":"This gem calculates descriptive statistics including measures of central tendency (e.g. mean, median mode), dispersion (e.g. range, and quartiles), and spread (e.g variance and standard deviation).","archived":true,"fork":false,"pushed_at":"2020-03-15T00:33:42.000Z","size":49,"stargazers_count":105,"open_issues_count":0,"forks_count":14,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-05T04:08:13.095Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://rubygems.org/gems/descriptive-statistics","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jtescher.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-29T19:23:33.000Z","updated_at":"2025-02-28T15:13:44.000Z","dependencies_parsed_at":"2022-08-25T20:50:52.942Z","dependency_job_id":null,"html_url":"https://github.com/jtescher/descriptive-statistics","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtescher%2Fdescriptive-statistics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtescher%2Fdescriptive-statistics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtescher%2Fdescriptive-statistics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtescher%2Fdescriptive-statistics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jtescher","download_url":"https://codeload.github.com/jtescher/descriptive-statistics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252860085,"owners_count":21815460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T01:00:40.246Z","updated_at":"2025-05-07T10:34:12.471Z","avatar_url":"https://github.com/jtescher.png","language":"Ruby","funding_links":[],"categories":["Statistics"],"sub_categories":[],"readme":"# DescriptiveStatistics\n\nThis gem calculates descriptive statistics including measures of central tendency (e.g. mean, median mode), dispersion\n(e.g. range, and quartiles), and spread (e.g variance and standard deviation).\n\nTested against 2.4.9, 2.5.7, 2.6.5, 2.7.0, ruby-head, jruby-9.1.9.0, jruby-head and rubinius-4.7.\n\n[![Build Status](https://secure.travis-ci.org/jtescher/descriptive-statistics.png)](http://travis-ci.org/jtescher/descriptive-statistics)\n[![Dependency Status](https://gemnasium.com/jtescher/descriptive-statistics.png)](https://gemnasium.com/jtescher/descriptive-statistics)\n[![Code Climate](https://codeclimate.com/github/jtescher/descriptive-statistics.png)](https://codeclimate.com/github/jtescher/descriptive-statistics)\n[![Gem Version](https://badge.fury.io/rb/descriptive-statistics.png)](http://badge.fury.io/rb/descriptive-statistics)\n[![Coverage Status](https://coveralls.io/repos/jtescher/descriptive-statistics/badge.png)](https://coveralls.io/r/jtescher/descriptive-statistics)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'descriptive-statistics'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install descriptive-statistics\n\n## Usage\n\n### Central Tendency:\n```ruby\nstats = DescriptiveStatistics::Stats.new([1,1,2,3,10])\nstats.mean #=\u003e 3.4\nstats.median #=\u003e 2\nstats.mode #=\u003e 1\n```\n\n### Dispersion:\n```ruby\nstats = DescriptiveStatistics::Stats.new([1,1,2,3,10])\nstats.range #=\u003e 9\nstats.min #=\u003e 1\nstats.max #=\u003e 10\nstats.percentile_from_value(10) #=\u003e 80\nstats.value_from_percentile(60) #=\u003e 3\n```\n\n### Spread:\n```ruby\nstats = DescriptiveStatistics::Stats.new([1,1,2,3,10])\nstats.variance #=\u003e 14.299999999999999\nstats.population_variance  #=\u003e 11.44\nstats.standard_deviation #=\u003e 3.7815340802378072\nstats.relative_standard_deviation #=\u003e 99.47961485463391\n```\n\n### Other Measures:\n```ruby\nstats = DescriptiveStatistics::Stats.new([1,1,2,3,10])\nstats.skewness #=\u003e 1.188328915820243\nstats.kurtosis #=\u003e 2.405613966453127\n```\n\n## Alternative Usage (Not suggested)\nIf you want to monkey patch descriptive statistics methods into Enumerable, you can use the following:\n\n(e.g. config/initializers/descriptive_statistics_monkey_patch.rb)\n```ruby\nrequire 'descriptive-statistics'\n\nmodule Enumerable\n  include DescriptiveStatistics\n\n  # Warning: hacky evil meta programming. Required because classes that have already included\n  # Enumerable will not otherwise inherit the statistics methods.\n  DescriptiveStatistics.instance_methods.each do |m|\n    define_method(m, DescriptiveStatistics.instance_method(m))\n  end\nend\n```\n\nThen you can use these methods directly on Arrays:\n```ruby\n[1,1,2,3,10].mean #=\u003e 3.4\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtescher%2Fdescriptive-statistics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjtescher%2Fdescriptive-statistics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtescher%2Fdescriptive-statistics/lists"}