Negative Binomial Distribution



Negative Binomial Distribution

Given a Bernoulli distributed random variable Y with possible outcomes { 0, 1 } where
Pr[ Y = 0 ] = p and Pr[ Y = 1 ] = 1 - p where 0 < p < 1.   Define the random variable X to be the number of 1's which occur before the occurrence n ≥ 1  0's in successive independent trials of the random variable Y. Then X is said to have a negative binomial distribution. The probability that k 1's occur before the nth 0 is
Pr[ X = k ] = f(k) = Cn + k - 1k pn ( 1 - p )k for k = 0,... .

The cumulative hypergeometric distribution function is therefore given
F(k) = Σi=0k f(i),
where f is given above.

Function List

  • double Negative_Binomial_Cumulative_Distribution( int n, int k, double p )

    This function returns F(k) where F(k) is described above.

  • double Negative_Binomial_Point_Distribution( int n, int k, double p )

    This function returns f(k) where f(k) is described above.

  • void Negative_Binomial_Distribution_Tables( int n, int size,double p, double* pr, double* cumulative )

    This function returns f(k) where f(k) is described above for k = 0,...,n in the array pr and returns F(k) where F(k) is described above for k = 0,...,n in the array cumulative.

Source Code

C source code is available for these routines: