# Lite::Statistics

Lite::Statistics is a library for generate statistics from collections of data points.

## Installation

Add this line to your application's Gemfile:

```
gem 'lite-statistics'
```

And then execute:

```
$ bundle
```

Or install it yourself as:

```
$ gem install lite-statistics
```

## Table of Contents

## Configurations

`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
```

## Descriptive

Sample|Population calculations will have a shorthand alias that defaults to sample.

Ex: `variance`

=> `sample_variance`

#### Summary

#### Count

#### Distribution

#### Central tendency

#### Dispersion

- Midrange aka Midextreme
- Range
- Percentile from Value aka Percentile
- Value from Percentile aka Percentile Rank

#### Spread

- Sample|Population Variance
- Sample|Population Standard Deviation
- Sample|Population Coefficient of Variation
- Sample|Population Standard Error
- Sample|Population Z-Scores

#### Shape

## Monkey patches

Including monkey patches will give you `Enumerable`

access to statistics.

```
[1, 2, 3, 1].mode #=> 1
```

## Benchmarks

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.

#### Baseline summaries

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 |

#### Full summaries

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 |

## Development

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.

## Contributing

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.

## License

The gem is available as open source under the terms of the MIT License.

## Code of Conduct

Everyone interacting in the Lite::Statistics projectâ€™s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.