Statistics2 -- Statistical Distributions for Ruby Author: Shin-ichiro HARA(sinara@blade.nagaokaut.ac.jp) Date: 2003.09.26 Requirements ------------ * ruby-1.8 Installation ------------ Copy `statistics2.rb' where Ruby can load. Installation of extension module (if you need) --------------------------------------------- This package also contains the C extension module which has the same functions in `statistics2.rb'. Enter ext/ directory of the package. Then type: $ ruby extconf.rb $ make $ make test $ make install Usage ----- Example: require "statistics2" puts Statistics2.normaldist(0.27) #=> 0.606419873198039 Class and Methods ----------------- Modules: Statistics2 Methods: --- Statistics2.normaldist(x) Returns the integral of normal distribution over (-Infty, x]. --- Statistics2.pnormaldist(pr) Returns the P-value of normaldist(x). --- Statistics2.normalxXX_(x) Returns the integral of normal distribution over (-Infty, x]. --- Statistics2.normal__X_(x) Returns the integral of normal distribution over [0, x]. --- Statistics2.normal___x(x) Returns the integral of normal distribution over [x, Infty). --- Statistics2.normalx__x(x) Returns the integral of normal distribution over (-Infty, -x] + [x, Infty). --- Statistics2.pnormalxXX_(pr) --- Statistics2.pnormal__X_(pr) --- Statistics2.pnormal___x(pr) --- Statistics2.pnormalx__x(pr) Return the P-value of the corresponding integral. --- Statistics2.chi2dist(n, x) Returns the integral of Chi-squared distribution with n degrees of freedom over [0, x]. --- Statistics2.pchi2dist(n, pr) Returns the P-value of chi2dist(). --- Statistics2.chi2X_(n, x) Returns the integral of Chi-squared distribution with n degrees of freedom over [0, x]. --- Statistics2.chi2_x(n, x) Returns the integral of Chi-squared distribution with n degrees of freedom over [x, Infty). --- Statistics2.pchi2X_(n, pr) --- Statistics2.pchi2_x(n, pr) Return the P-value of the corresponding integral. --- Statistics2.tdist(n, x) Returns the integral of t-distribution with n degrees of freedom over (-Infty, x]. --- Statistics2.ptdist(n, pr) Returns the P-value of tdist(). --- Statistics2.txXX_(n, x) Returns the integral of t-distribution with n degrees of freedom over (-Infty, x]. --- Statistics2.t__X_(n, x) Returns the integral of t-distribution with n degrees of freedom over [0, x]. --- Statistics2.t___x(n, x) Returns the integral of t-distribution with n degrees of freedom over [x, Infty). --- Statistics2.tx__x(n, x) Returns the integral of normal distribution with n degrees of freedom over (-Infty, -x] + [x, Infty). --- Statistics2.ptxXX_(n, pr) --- Statistics2.pt__X_(n, pr) --- Statistics2.pt___x(n, pr) --- Statistics2.ptx__x(n, pr) Return the P-value of the corresponding integral. --- Statistics2.fdist(n1, n2, x) Returns the integral of F-distribution with n1 and n2 degrees of freedom over [0, x]. --- Statistics2.pfdist(n1, n2, pr) Returns the P-value of fdist(). --- Statistics2.fX_(n1, n2, x) Returns the integral of F-distribution with n1 and n2 degrees of freedom over [0, x]. --- Statistics2.f_x(n1, n2, x) Returns the integral of F-distribution with n1 and n2 degrees of freedom over [x, Infty). --- Statistics2.pfX_(n1, n2, pr) --- Statistics2.pf_x(n1, n2, pr) Return the P-value of the corresponding integral. Samples ------- ruby sample-tbl.rb norm ... table of normal distribution ruby sample-tbl.rb chi2 ... table of chi-square distribution ruby sample-tbl.rb t ... table of t distribution ruby sample-tbl.rb f ... table of f distribution License ------- Ruby's (see http://www.ruby-lang.org/en/LICENSE.txt) Changes ------- 0.53(2008.07.14) * fix pt for p < 0.5. 0.52(2008.02.24) * fix p_nor for z < 0.0. 0.51(2007.06.17) * fix p_nor. * simplify chi2 n = 1 or 2.