3 * Negative binomial distribution
10 * float p, y, nbdtrf();
12 * y = nbdtrf( k, n, p );
18 * Returns the sum of the terms 0 through k of the negative
19 * binomial distribution:
27 * In a sequence of Bernoulli trials, this is the probability
28 * that k or fewer failures precede the nth success.
30 * The terms are not computed individually; instead the incomplete
31 * beta integral is employed, according to the formula
33 * y = nbdtr( k, n, p ) = incbet( n, k+1, p ).
35 * The arguments must be positive, with p ranging from 0 to 1.
42 * arithmetic domain # trials peak rms
43 * IEEE 0,100 5000 1.5e-4 1.9e-5
48 * Complemented negative binomial distribution
55 * float p, y, nbdtrcf();
57 * y = nbdtrcf( k, n, p );
63 * Returns the sum of the terms k+1 to infinity of the negative
64 * binomial distribution:
72 * The terms are not computed individually; instead the incomplete
73 * beta integral is employed, according to the formula
75 * y = nbdtrc( k, n, p ) = incbet( k+1, n, 1-p ).
77 * The arguments must be positive, with p ranging from 0 to 1.
84 * arithmetic domain # trials peak rms
85 * IEEE 0,100 5000 1.4e-4 2.0e-5
90 Cephes Math Library Release 2.2: July, 1992
91 Copyright 1984, 1987 by Stephen L. Moshier
92 Direct inquiries to 30 Frost Street, Cambridge, MA 02140
98 float incbetf(float, float, float);
105 float nbdtrcf( int k, int n, float pp )
107 float nbdtrcf( k, n, pp )
115 if( (p < 0.0) || (p > 1.0) )
120 mtherr( "nbdtrf", DOMAIN );
126 return( incbetf( dk, dn, 1.0 - p ) );
132 float nbdtrf( int k, int n, float pp )
134 float nbdtrf( k, n, pp )
142 if( (p < 0.0) || (p > 1.0) )
147 mtherr( "nbdtrf", DOMAIN );
152 return( incbetf( dn, dk, p ) );