Main Content


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


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



collapse all

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

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a