nbincdf

Negative binomial cumulative distribution function

Syntax

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

Description

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)=i=0x(r+i1i)prqiI(0,1,...)(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

Γ(r+i)Γ(r)Γ(i+1)

Examples

expand all

Compute Negative Binomial Distribution CDF

x = (0:15);
p = nbincdf(x,3,0.5);
stairs(x,p)

Was this topic helpful?