Negative binomial cumulative distribution function

`y = nbincdf(x,R,p)`

y = nbincdf(x,R,p,'upper')

`y = nbincdf(x,R,p)`

computes
the negative binomial cdf at each of the values in `x`

using
the corresponding number of successes, `R`

and probability
of success in a single trial, `p`

. `x`

, `R`

,
and `p`

can be vectors, matrices, or multidimensional
arrays that all have the same size, which is also the size of `y`

.
A scalar input for `x`

, `R`

, or `p`

is
expanded to a constant array with the same dimensions as the other
inputs.

`y = nbincdf(x,R,p,'upper')`

returns the
complement of the negative binomial cdf at each value in `x`

,
using an algorithm that more accurately computes the extreme upper
tail probabilities.

The negative binomial cdf is

$$y=F(x|r,p)={\displaystyle \sum _{i=0}^{x}\left(\begin{array}{c}r+i-1\\ i\end{array}\right)}{p}^{r}{q}^{i}{I}_{(0,1,\mathrm{...})}(i)$$

The simplest motivation for the negative binomial is the case
of successive random trials, each having a constant probability `p`

of
success. The number of *extra* trials you must
perform in order to observe a given number `R`

of
successes has a negative binomial distribution. However, consistent
with a more general interpretation of the negative binomial, `nbincdf`

allows `R`

to
be any positive value, including nonintegers. When `R`

is
noninteger, the binomial coefficient in the definition of the cdf
is replaced by the equivalent expression

$$\frac{\Gamma (r+i)}{\Gamma (r)\Gamma (i+1)}$$

Was this topic helpful?