Project

## rubystats

0.19
Low commit activity in last 3 years
No release in over a year
Ruby Stats is a port of the statistics libraries from PHPMath. Probability distributions include binomial, beta, and normal distributions with PDF, CDF and inverse CDF as well as Fisher's Exact Test.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
Development
Primary Language
Ruby
MIT
Dependencies

>= 1.7.0
>= 4.2, < 5.0

>= 0

# Rubystats¶ ↑

## DESCRIPTION:¶ ↑

```This is a set of Ruby statistics libraries ported from the PHPMath libraries.
PHPMath libraries created by Paul Meagher (many of which were ported from
various sources).
See http://www.phpmath.com/ for PHPMath libraries.

Currently includes classes for normal, binomial, beta and exponential distributions, with more

See examples and tests for usage.```

## NOTE for version 0.2.0:¶ ↑

```The API has changed somewhat in version 0.2. All tests pass with the old API, but
You now if you want to load just one of the distributions, you must require it like:

require 'rubystats/normal_distribution'

Then prefix the class name with the Rubystats module name:
norm = Rubystats::NormalDistribution.new(10, 2)

Alternatively, you can simply require 'rubystats' and have all the classes loaded, and
have the Rubystats module included.```

## Author: ¶ ↑

```Bryan Donovan
2006-2008
```

## WARNING:¶ ↑

This is beta-quality software. It works well according to my tests, but the API may change and other features may be added.

## FEATURES:¶ ↑

Classes for continuous distributions:

• Beta

• Cauchy

• Exponential

• Gamma

• Lognormal

• Multivariate Normal

• Normal

• Student t

• Uniform

• Weibull

Classes for discrete distributions:

• Binomial

• Poisson

Also includes Fisher’s Exact Test

## SYNOPSIS:¶ ↑

### Example: normal distribution with mean of 10 and standard deviation of 2¶ ↑

```norm = Rubystats::NormalDistribution.new(10.0, 2.0)
cdf = norm.cdf(11)
pdf = norm.pdf(11)
puts "CDF(11): #{cdf}"
puts "PDF(11): #{pdf}"
```

Output:

```CDF(11): 0.691462461274013
PDF(11): 0.17603266338214973```

### Example: get some random numbers from a normal distribution¶ ↑

```puts "Random numbers from normal distribution:"
10.times do
puts norm.rng
end
```

(sample) Output:

```18.8877297946427
-15.4463065628574
4.55538065315298
17.0281528150355
3.16543873165151
2.48599492216993
14.3947330544886
-3.47989062859462
5.05832591294848
31.2952983108343
```

## REQUIREMENTS:¶ ↑

• Ruby >= 1.9.3 (may work with earlier versions)

## INSTALL:¶ ↑

• sudo gem install rubystats