Next: , Previous: , Up: Functions and Variables for discrete distributions   [Contents][Index]

52.3.7 Hypergeometric Random Variable

The hypergeometric distribution is a discrete probability distribution.

Let \(n_1\) be the number of objects of a class \(A\) and \(n_2\) be the number of objects of class \(B\). We take out \(n\) objects, without replacment. Then the hypergeometric distribution is the probability that exactly \(k\) objects are from class \(A\). Of course \(n \leq n_1 + n_2\).

Function: pdf_hypergeometric (x,n_1,n_2,n)

Returns the value at x of the probability function of a \({\it Hypergeometric}(n1,n2,n)\)

random variable, with \(n_1\), \(n_2\) and \(n\) non negative integers and \(n\leq n_1+n_2\). Being \(n_1\) the number of objects of class A, \(n_2\) the number of objects of class B, and \(n\) the size of the sample without replacement, this function returns the probability of event "exactly x objects are of class A".

To make use of this function, write first load("distrib").

The pdf is

\[f(x; n_1, n_2, n) = {\displaystyle{n_1\choose x} {n_2 \choose n-x} \over \displaystyle{n_2+n_1 \choose n}} \]

Categories: Package distrib ·
Function: cdf_hypergeometric (x,n_1,n_2,n)

Returns the value at x of the distribution function of a \({\it Hypergeometric}(n1,n2,n)\)

random variable, with \(n_1\), \(n_2\) and \(n\) non negative integers and \(n\leq n_1+n_2\). See pdf_hypergeometric for a more complete description.

To make use of this function, write first load("distrib").

The cdf is

\[F(x; n_1, n_2, n) = {n_2+n_1\choose n}^{-1} \sum_{k=0}^{\lfloor x \rfloor} {n_1 \choose k} {n_2 \choose n - k} \]

Categories: Package distrib ·
Function: quantile_hypergeometric (q,n1,n2,n)

Returns the q-quantile of a \({\it Hypergeometric}(n1,n2,n)\) random variable, with n1, n2 and n non negative integers and \(n\leq n1+n2\); in other words, this is the inverse of cdf_hypergeometric. Argument q must be an element of \([0,1]\). To make use of this function, write first load("distrib").

Categories: Package distrib ·
Function: mean_hypergeometric (n_1,n_2,n)

Returns the mean of a discrete uniform random variable \({\it Hypergeometric}(n_1,n_2,n)\) , with \(n_1\), \(n_2\) and \(n\) non negative integers and \(n\leq n_1+n_2\). To make use of this function, write first load("distrib").

The mean is

\[E[X] = {n n_1\over n_2+n_1} \]

Categories: Package distrib ·
Function: var_hypergeometric (n1,n2,n)

Returns the variance of a hypergeometric random variable \({\it Hypergeometric}(n_1,n_2,n)\) , with \(n1\), \(n2\) and \(n\) non negative integers and \(n<=n1+n2\). To make use of this function, write first load("distrib").

The variance is

\[V[X] = {n n_1 n_2 (n_1 + n_2 - n) \over (n_1 + n_2 - 1) (n_1 + n_2)^2} \]

Categories: Package distrib ·
Function: std_hypergeometric (n_1,n_2,n)

Returns the standard deviation of a \({\it Hypergeometric}(n_1,n_2,n)\) random variable, with \(n_1\), \(n_2\) and \(n\) non negative integers and \(n\leq n_1+n_2\). To make use of this function, write first load("distrib").

The standard deviation is

\[D[X] = {1\over n_1+n_2}\sqrt{n n_1 n_2 (n_1 + n_2 - n) \over n_1+n_2-1} \]

Categories: Package distrib ·
Function: skewness_hypergeometric (n_1,n_2,n)

Returns the skewness coefficient of a \({\it Hypergeometric}(n1,n2,n)\) random variable, with \(n_1\), \(n_2\) and \(n\) non negative integers and \(n\leq n1+n2\). To make use of this function, write first load("distrib").

The skewness coefficient is

\[SK[X] = {(n_2-n_2)(n_1+n_2-2n)\over n_1+n_2-2} \sqrt{n_1+n_2-1 \over n n_1 n_2 (n_1+n_2-n)} \]

Categories: Package distrib ·
Function: kurtosis_hypergeometric (n_1,n_2,n)

Returns the kurtosis coefficient of a \({\it Hypergeometric}(n_1,n_2,n)\) random variable, with \(n_1\), \(n_2\) and \(n\) non negative integers and \(n\leq n1+n2\). To make use of this function, write first load("distrib").

The kurtosis coefficient is

\[ \eqalign{ KU[X] = & \left[{C(1)C(0)^2 \over n n_1 n_2 C(3)C(2)C(n)}\right. \cr & \times \left.\left( {3n_1n_2\left((n-2)C(0)^2+6nC(n)-n^2C(0)\right) \over C(0)^2 } -6nC(n) + C(0)C(-1) \right)\right] \cr &-3 } \]

where \(C(k) = n_1+n_2-k\) .

Categories: Package distrib ·
Function: random_hypergeometric (n1,n2,n)
    random_hypergeometric (n1,n2,n,m)

Returns a \({\it Hypergeometric}(n1,n2,n)\) random variate, with n1, n2 and n non negative integers and \(n<=n1+n2\). Calling random_hypergeometric with a fourth argument m, a random sample of size m will be simulated.

Algorithm described in Kachitvichyanukul, V., Schmeiser, B.W. (1985) Computer generation of hypergeometric random variates. Journal of Statistical Computation and Simulation 22, 127-145.

To make use of this function, write first load("distrib").

Categories: Package distrib · Random numbers ·

Next: , Previous: , Up: Functions and Variables for discrete distributions   [Contents][Index]

JavaScript license information