Friday, 1 November 2013

Hypergeometric Distribution CDF and Quantile Calculator

An implementation of the Hypergeomtric Distribution CDF and Quantile function Calculator occurs below. The Hypergeometric Distribution is a Probability Mass Function (PMF) as it describes the distribution of discrete random variables, which are integers from 0 upwards i.e. positive integers. It is almost unique in having three positive integer parameters $N$, $r$ and $n$, and its PMF is:-

$\Huge \frac{{r \choose k}{N-r \choose n-k}}{{N \choose n}}$  

where the random variable is an integer $k\geq 0$. Parameters $r$ and $n$ must lie in range 0,1,2,..,$N$. A good way to understand the Hypergeometric distribution is to think of a bag containing $N$ marbles, where $r$ is the number of red marbles, and $N-r$ is the number of blue marbles. Assume we draw $n$ marbles without replacement. The Hypergeometric PMF gives the probability that out of these $n$ drawn marbles, there will be $k$ red marbles.

The $N$, $r$ and $n$ fields need to be filled in, as well as one out of the two fields which are labelled Upper Limit and Probability. The upper limit field needs to contain an integer number greater than or equal to 0. The probability field must contain a number between 0 and 1 only.


Upper limit:

Plot of distribution ($f(x)$) values against $x$ values