Generate statistics from collections of data points
Lite::Statistics is a library for generate statistics from collections of data points.
Add this line to your application’s Gemfile:
gem 'lite-statistics'
And then execute:
$ bundle
Or install it yourself as:
$ gem install lite-statistics
rails g lite:statistics:install
will generate the following file:
../config/initalizers/lite_statistics.rb
Lite::Statistics.configure do |config|
config.monkey_patches = true
end
Sample | Population calculations will have a shorthand alias that defaults to sample. |
Ex: variance
=> sample_variance
[Sample | Population Summary](https://github.com/drexed/lite-statistics/blob/master/docs/descriptive/SUMMARY.md) |
[Sample | Population Size](https://github.com/drexed/lite-statistics/blob/master/docs/descriptive/SIZE.md) |
[Sample | Population Variance](https://github.com/drexed/lite-statistics/blob/master/docs/descriptive/VARIANCE.md) |
[Sample | Population Standard Deviation](https://github.com/drexed/lite-statistics/blob/master/docs/descriptive/STANDARD_DEVIATION.md) |
[Sample | Population Coefficient of Variation](https://github.com/drexed/lite-statistics/blob/master/docs/descriptive/COEFFICIENT_OF_VARIATION.md) |
[Sample | Population Standard Error](https://github.com/drexed/lite-statistics/blob/master/docs/descriptive/STANDARD_ERROR.md) |
[Sample | Population Z-Scores](https://github.com/drexed/lite-statistics/blob/master/docs/descriptive/ZSCORES.md) |
[Sample | Population Skewness](https://github.com/drexed/lite-statistics/blob/master/docs/descriptive/SKEWNESS.md) |
[Sample | Population Kurtosis](https://github.com/drexed/lite-statistics/blob/master/docs/descriptive/KURTOSIS.md) |
Including monkey patches will give you Enumerable
access to statistics.
[1, 2, 3, 1].mode #=> 1
All benchmarks are executed using the baseline summary (exact same calculations for each)
and the full summary (all available calculations for each). Each is generated
using an array containing 1 million random integers on the 2.6.3
Ruby version.
View how each compares to other libs by running the benchmarks.
Library | # of Calculations | IPS | Speed |
---|---|---|---|
lite-statistics | 13 | 2.5 i/s | — |
descriptive_statistics | 13 | 0.6 i/s | 4.16x slower |
descriptive-statistics | 13 | 1.8 i/s | 1.40x slower |
statistica | 13 | — | Too slow to run |
Library | # of Calculations | IPS | Speed |
---|---|---|---|
lite-statistics | 22 | 1.0 i/s | — |
descriptive_statistics | 13 | 0.6 i/s | 1.72x slower |
descriptive-statistics | 16 | 0.9 i/s | 1.10x slower |
statistica | 19 | — | Too slow to run |
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lite-statistics. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Lite::Statistics project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.