Skip to content

flajann2/statistics3

 
 

Repository files navigation

Statistics3 – Statistical Distributions for Ruby

I forked Shin-ichiro’s statistics2 (sinara@blade.nagaokaut.ac.jp), work, because it is in serious need of modernization for the latest Ruby, and I am currently depending on this library for my RubyNEAT work.

For more information (in Japanese and so use Google Translate) . http://www5.airnet.ne.jp/tomy/cpro/sslib11.htm

REQUIREMENTS

Ruby 2.2.2 or higher

Installation

gem install statistics3

Documentation

Note that I’ve just modernized this fork, and will attempt to add more documentation as time permits.

List of all available functions

  • binX_(n, p, x)
  • bin_x(n, p, x)
  • bindens(n, p, x)
  • bindist(n, p, x)
  • chi2X_(n, x)
  • chi2_x(n, x)
  • chi2dens(n, x)
  • chi2dist(n, x)
  • combi(n, x)
  • fX_(n1, n2, x)
  • f_x(n1, n2, x)
  • fdist(n1, n2, f)
  • gamma(x)
  • loggamma(x)
  • newton_a(y, ini, epsilon = 1.0e-6, limit = 30)
  • normal__X_(z)
  • normal___x(z)
  • normaldist(z)
  • normalxXX_(z)
  • normalx__x(z)
  • p_nor(z)
  • p_t(df, t)
  • pchi2(n, y)
  • pchi2X_(n, y)
  • pchi2_x(n, y)
  • pchi2dist(n, y)
  • perm(n, x = n)
  • pf(q, n1, n2)
  • pfX_(n1, n2, x)
  • pf_x(n1, n2, x)
  • pfdist(n1, n2, y)
  • pfsub(x, y, z)
  • pnorm(qn)
  • pnormal__X_(y)
  • pnormal___x(y)
  • pnormaldist(y)
  • pnormalxXX_(z)
  • pnormalx__x(y)
  • poissonX_(m, x)
  • poisson_x(m, x)
  • poissondens(m, x)
  • poissondist(m, x)
  • pt(q, n)
  • pt__X_(n, y)
  • pt___x(n, y)
  • ptdist(n, y)
  • ptsub(q, n)
  • ptxXX_(n, y)
  • ptx__x(n, y)
  • q_chi2(df, chi2)
  • q_f(df1, df2, f)
  • t__X_(n, x)
  • t___x(n, x)
  • tdist(n, t)
  • txXX_(n, x)
  • tx__x(n, x)

Distribution

Normal Distribution

Integral of normal distribution over (-Infty, x].normalxXX_(z)
Integral of normal distribution over [0, x].normal__X_(z)
Integral of normal distribution over [x, Infty).normal___x(z)
Integral of normal distribution over (-Infty, -x] + [x, Infty).normalx__x(z)

Inverse of normal-distribution

P-value of the corresponding integral.pnormalxXX_(z)
P-value of the corresponding integral.pnormal__X_(y)
P-value of the corresponding integral.pnormal___x(y)
P-value of the corresponding integral.pnormalx__x(y)

Chi2-distribution

Integral of Chi-squared distribution with n degrees of freedom over [x, Infty).chi2_x(n, x)
Integral of Chi-squared distribution with n degrees of freedom over [0, x].chi2X_(n, x)

Inverse of chi2-distribution

P-value of the corresponding integral.pchi2_x(n, y)
P-value of the corresponding integral.pchi2X_(n, y)

t-distribution

Integral of normal distribution with n degrees of freedom over (-Infty, -x] + [x, Infty).tx__x(n, x)
Integral of t-distribution with n degrees of freedom over (-Infty, x].txXX_(n, x)
Integral of t-distribution with n degrees of freedom over [0, x].t__X_(n, x)
Integral of t-distribution with n degrees of freedom over [x, Infty).t___x(n, x)

inverse of t-distribution

P-value of the corresponding integral.ptx__x(n, y)
P-value of the corresponding integral.ptxXX_(n, y)
P-value of the corresponding integral.pt__X_(n, y)
P-value of the corresponding integral.pt___x(n, y)

F-distribution

Integral of F-distribution with n1 and n2 degrees of freedom over [x, Infty).f_x(n1, n2, x)
Integral of F-distribution with n1 and n2 degrees of freedom over [0, x].fX_(n1, n2, x)

Inverse of F-distribution

P-value of the corresponding integral.pf_x(n1, n2, x)
P-value of the corresponding integral.pfX_(n1, n2, x)

Discrete distributions

  • binX_(n, p, x)
  • bin_x(n, p, x)
  • poissonX_(m, x)
  • poisson_x(m, x)

Usage

Example:

require "statistics3"
puts Statistics3.normaldist(0.27) #=> 0.60641987319804

If you don’t want to use the C extension:

require "statistics3/no_ext"
puts Statistics3.normaldist(0.27) #=> 0.606419873198039 (delta of 9.99200722162641e-16)

LICENSE:

MIT

About

I've forked this from Shin-ichiro Hara's library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 65.6%
  • C 34.4%