Go to file
Arthur POULET 40cf508311
Update version
Change architecture

Upgrade crystal version

Change license to GPL-3

Add several new functions and helpers (radian/degree, means, macd, ...)
2017-07-06 15:02:13 +01:00
spec Add basic MACD 2017-07-06 13:13:08 +01:00
src Update version 2017-07-06 15:02:13 +01:00
.gitignore Initialize the repository 2016-06-27 15:39:37 +02:00
.travis.yml Initialize the repository 2016-06-27 15:39:37 +02:00
CHANGELOG.md Improve normale distribution and update v0.1.6 2016-07-01 01:09:21 +02:00
LICENSE Change LICENSE to GPL-3.0 2017-04-13 22:42:05 +01:00
README.md Update readme: Working with crystal 0.23 2017-07-06 13:14:20 +01:00
shard.yml Change LICENSE to GPL-3.0 2017-04-13 22:42:05 +01:00

README.md

stats

An expressive implementation of statistical distributions. Compatible with crystal v0.23

Installation

Add this to your application's shard.yml:

dependencies:
  Stats:
    github: Nephos/stats

Usage

Include it

require "stats"

Normal distribution

NormaleDistribution::between # less_than, greater_than
  standard_deviation: 15,
  esperance: 100,
  min: 85,
  max: 115
  # => 0.6826894921370859

Binomial distribution

Math.binomial_distribution(
  tries: 3,
  probability: 0.5,
  success: 1)
  # => 0.375

Binomial coefficient

Math.coef_binomial(5, 2) # => 10

Factorial

Math.factorial(4) # => 24

Radian and degree

90.radian # => (Math::PI / 2)
(Math::PI / 4) # => 45.0

Series & Statistics

[1, 2, 3].mean # => 2.0
[1, 2, 3].variance # => 0.6667
[1, 2, 3].standard_deviation # => 0.8165
[1, 2, 3].quadratic_mean # => 2.16
[2, 32].geometric_mean # => 8.0
[40, 60].harmonic_mean # => 48.0
[1,2,3,2,1].macd 3 # => [2.0, 2.333, 2.0]

Development

  • The lib is adapted to be usable with BigInt and BigFloat values

Contributing

  1. Fork it ( https://github.com/Nephos/stats/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • Nephos Arthur Poulet - creator, maintainer