Sha256: cb854b9602ef49fc07dece73d20ebe3f7639bf193dc6b30d8b42633451cf912f

Contents?: true

Size: 788 Bytes

Versions: 7

Compression:

Stored size: 788 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
            # 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

7 entries across 7 versions & 1 rubygems

Version Path
statsample-0.6.2 lib/distribution/normal.rb
statsample-0.6.1 lib/distribution/normal.rb
statsample-0.6.0 lib/distribution/normal.rb
statsample-0.5.1 lib/distribution/normal.rb
statsample-0.5.0 lib/distribution/normal.rb
statsample-0.4.1 lib/distribution/normal.rb
statsample-0.4.0 lib/distribution/normal.rb