File: hypergeometric.rb

package info (click to toggle)
ruby-distribution 0.7.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 572 kB
  • ctags: 370
  • sloc: ruby: 4,270; makefile: 5
file content (39 lines) | stat: -rw-r--r-- 1,295 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'distribution/hypergeometric/ruby'
require 'distribution/hypergeometric/gsl'
require 'distribution/hypergeometric/java'


module Distribution
  # From Wikipedia:
  #   In probability theory and statistics, the hypergeometric distribution is a discrete probability distribution that
  #   describes the number of successes in a sequence of n draws from a finite population without replacement, just as
  #   the binomial distribution describes the number of successes for draws with replacement.
  module Hypergeometric
    SHORTHAND='hypg'
    extend Distributable

    create_distribution_methods

    ##
    # :singleton-method: pdf(k,m,n,total)
    # This function computes the probability p(k) of obtaining k 
    # from a hypergeometric distribution with parameters 
    # m, n t.
    # * m: number of elements with desired attribute on population
    # * n: sample size    
    # * t: population size

    ##
    # :singleton-method: cdf(k,m,n,total)
    # These functions compute the cumulative distribution function P(k)
    # for the hypergeometric distribution with parameters m, n and t. 
    # * m: number of elements with desired attribute on population
    # * n: sample size
    # * t: population size
    

    ##
    # :singleton-method: p_value(k,m,n,total)

  end
end