Sha256: cea1b5b7ab3b8174f65aaddbc34fee913208fb54a45a82efb7a903b3ed525b8a

Contents?: true

Size: 698 Bytes

Versions: 6

Compression:

Stored size: 698 Bytes

Contents

module Distribution
    # Calculate cdf and inverse cdf for Chi Square Distribution.
    # 
    # Based on Statistics2 module
    # 
    module ChiSquare
        class << self
            # Return the P-value of the corresponding integral with 
            # k degrees of freedom
            def p_value(pr,k)
                Statistics2.pchi2X_(k.to_i, pr)
            end
            # Chi-square cumulative distribution function (cdf).
            # 
            # Returns the integral of Chi-squared distribution 
            # with k degrees of freedom over [0, x]
            # 
            def cdf(x, k)
                Statistics2.chi2dist(k.to_i,x)
            end
        end
    end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
statsample-0.18.0 lib/distribution/chisquare.rb
statsample-0.17.0 lib/distribution/chisquare.rb
statsample-0.16.0 lib/distribution/chisquare.rb
statsample-0.15.1 lib/distribution/chisquare.rb
statsample-0.15.0 lib/distribution/chisquare.rb
statsample-0.14.1 lib/distribution/chisquare.rb