Sha256: bdeaca37b1efadf9a8ce7c57fa5918eb678467813b6aed66916074ce30dd76ce
Contents?: true
Size: 825 Bytes
Versions: 11
Compression:
Stored size: 825 Bytes
Contents
module Distribution # Calculate cdf and inverse cdf for Normal Distribution. # Uses Statistics2 module module Normal class << self # Return the P-value of the corresponding integral def p_value(pr) Statistics2.pnormaldist(pr) end # Normal cumulative distribution function (cdf). # # Returns the integral of normal distribution # over (-Infty, x]. # def cdf(x) Statistics2.normaldist(x) end if false and Distribution.has_gsl? alias :cdf_ruby :cdf def cdf(x) # :nodoc: GSL::Cdf::gaussian_P(x) end end # Normal probability density function (pdf) # With x=0 and sigma=1 def pdf(x) (1.0/Math::sqrt(2*Math::PI))*Math::exp(-(x**2/2.0)) end end end end
Version data entries
11 entries across 11 versions & 1 rubygems